classRowAssignment
final class RowAssignment
implements Node
uses Snapshot
Public API: explicitly declared with
@visibility public.One (column, ...) = source item of a SET list: several columns assigned from one row or one sub-SELECT.
Mirrors the MultiAssignRef items PostgreSQL makes of the item. The source must be a row constructor or a scalar subquery with one value per column. The facts follow PG-ASSIGNMENT-001. Source: https://www.postgresql.org/docs/17/sql-update.html.
$update = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('UPDATE t SET (a, b) = (1, 2)');
count($update->statement->assignments[0]->columns) // => 2new \SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Assignment\RowAssignment([], new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstructionProperties§
public non-empty-list<ColumnTarget> $columnspublic Scalar $sourceMethods§
public function __construct(list<ColumnTarget> $columns, public Scalar $source)Parameters
$columns | list<ColumnTarget> | The columns written, in order; at least one |
$source | Scalar | The row or the sub-SELECT that supplies the values |
Throws
InvalidConstruction When there is no columnCalls 2
- static-call Check::listOf() line 46
- class-const ColumnTarget::class() line 46
public function render(Output $out): voidWrites the parenthesized columns, = and the source.
Parameters
$out | Output |
Calls 1
- method-call Output::symbol() line 54
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
RowAssignmentTestcalls
Other tests reaching this symbol 2
Relations§
Instantiated in 1
Constant reads 3
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Conflict\ConflictDoUpdate::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Conflict/ConflictDoUpdate.php:50
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge\MergeUpdate::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Merge/MergeUpdate.php:44
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Update::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Update.php:71
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Assignments::defaults() packages/sql-semantics-postgres/src/Rules/Manipulation/Assignments.php:258
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\GeneratedWrites::updated() packages/sql-semantics-postgres/src/Rules/Manipulation/GeneratedWrites.php:94