final class MergeRule
Restricted visibility: declared "@visibility SqlSemantics". Code outside that scope must not name this declaration.

Lowers MERGE.

Rule: PG-MERGE-LOWER-001. Scope: MergeStmt, merge_when_list, merge_when_clause, merge_when_tgt_matched, merge_when_tgt_not_matched, opt_merge_when_condition, merge_update, merge_delete, merge_insert, merge_values_clause. Constructors: Merge, MergeWhen with MergeMatch, MergeUpdate, MergeDelete, MergeInsert, MergeInsertDefaults, MergeNothing. PostgreSQL 16 writes the kind of a clause inside merge_when_clause; PostgreSQL 17 adds NOT MATCHED BY SOURCE, the optional BY TARGET and RETURNING. Termination: the clause list is flattened iteratively. Source: https://www.postgresql.org/docs/17/sql-merge.html, https://www.postgresql.org/docs/16/sql-merge.html. Status: Implemented.

Methods§

public function __construct(private Lowering $lowering)

Parameters

$loweringLoweringThe hub
public function condition(Node $condition): ?Scalar

Lowers opt_merge_when_condition; no condition is null.

Parameters

$conditionNode

Returns

Throws

ImplementationGap When the production has no rule
Called from 1
Calls 1

Private surface 3§

Implementation details, listed for orientation only.

private const CLAUSES = ['merge_when_clause: WHEN MATCHED opt_merge_when_condition THEN merge_update' =…
private const KINDS = ['merge_when_tgt_matched: WHEN MATCHED' => \SqlSemantics\Platform\PostgreSql\St…
private Lowering $lowering

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Method calls 1