final class MergeFacts
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Derives the facts of MERGE.

Rule: PG-MERGE-001. The common tables, the target and the source follow PG-MODIFICATION-SCOPE-001. The join condition sees the target and the source. A WHEN MATCHED clause sees both; a WHEN NOT MATCHED BY SOURCE clause sees the target only; a WHEN NOT MATCHED [BY TARGET] clause sees the source only. UPDATE SET follows PG-ASSIGNMENT-001; INSERT follows the column and value rules of PG-INSERT-001 for one VALUES row; both write a generated column with DEFAULT only (PG-GENERATED-WRITE-001). A WHEN clause after a clause of the same kind without condition can never apply and is reported. RETURNING (PostgreSQL 17) sees the target and the source; with a WHEN NOT MATCHED BY SOURCE clause the source columns can be NULL. MERGE_ACTION() is admitted in RETURNING only (PG-PLACEMENT-001). Source: https://www.postgresql.org/docs/17/sql-merge.html, https://www.postgresql.org/docs/17/functions-merge-support.html. Status: Implemented.

Methods§

public function clause(
    MergeWhen $clause,
    VisibleRelation $target,
    Derivation $derivation,
    Environment $environment,
): list<DefaultRequest>
public function bySource(Merge $merge): bool

Tells whether a MERGE has a WHEN NOT MATCHED BY SOURCE clause.

Parameters

$mergeMerge

Returns

bool
Called from 1
Calls 1
public function nullable(list<VisibleRelation> $relations): list<VisibleRelation>

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