classMergeUpdate
final class MergeUpdate
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.The action UPDATE SET of a MERGE WHEN clause: the target row is updated.
Mirrors a MergeWhenClause with CMD_UPDATE and its target list. Source: https://www.postgresql.org/docs/17/sql-merge.html.
$merge = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('MERGE INTO t USING u ON t.a = u.a WHEN MATCHED THEN UPDATE SET b = DEFAULT');
count($merge->statement->clauses[0]->action->assignments) // => 1new \SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge\MergeUpdate([]) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public non-empty-list<Assignment|RowAssignment> $assignmentsMethods§
public function __construct(list<Assignment|RowAssignment> $assignments)Parameters
$assignments | list<Assignment|RowAssignment> | The SET items in written order; at least one |
Throws
InvalidConstruction When there is no SET itemCalls 4
- method-call ClosedList::of() line 44
- new ClosedList line 44
- class-const Assignment::class() line 44
- class-const RowAssignment::class() line 44
public function render(Output $out): voidWrites UPDATE SET and the assignments.
Parameters
$out | Output |
Calls 1
- method-call Output::keyword() line 52
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
MergeUpdateTestcalls
Relations§
Instantiated in 1
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\MergeFacts::clause() packages/sql-semantics-postgres/src/Rules/Manipulation/MergeFacts.php:89
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge\MergeWhen::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Merge/MergeWhen.php:46
Type declarations 2
- type SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\MergeRule packages/sql-semantics-postgres/src/Lowering/Manipulation/MergeRule.php:136
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge\MergeWhen packages/sql-semantics-postgres/src/Statement/Manipulation/Merge/MergeWhen.php:43