classColumnTarget
final class ColumnTarget
implements Clause
uses Snapshot
Public API: explicitly declared with
@visibility public.A column an INSERT column list or an assignment writes, with the subscripts and fields of the part written.
Mirrors the name and indirection of PostgreSQL's ResTarget in an INSERT column list or an UPDATE SET item. The name is always a column of the written table, never a table qualifier. Source: https://www.postgresql.org/docs/17/sql-insert.html, https://www.postgresql.org/docs/17/sql-update.html.
$update = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('UPDATE t SET a[1] = 2');
[$update->statement->assignments[0]->column->column->value, count($update->statement->assignments[0]->column->steps)] // => ['a', 1]Properties§
public list<IndirectionStep> $stepspublic Name $columnMethods§
public function __construct(public Name $column, list<IndirectionStep> $steps = [])Parameters
$column | Name | The column name |
$steps | list<IndirectionStep> | The subscripts and field selections after the column name |
Throws
InvalidConstruction When a step is not an indirection stepCalls 2
- static-call Check::listOf() line 48
- class-const IndirectionStep::class() line 48
public function deriveClause(Derivation $derivation, Environment $environment): voidDerives the subscript expressions of the steps.
Parameters
$derivation | Derivation | |
$environment | Environment |
public function render(Output $out): voidWrites the column name and the steps.
Parameters
$out | Output |
Calls 3
- method-call Output::name() line 66
- class-const NameUse::Column() line 66
- method-call Output::node() line 68
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
ColumnTargetTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\ChangeRule::column() packages/sql-semantics-postgres/src/Lowering/Manipulation/ChangeRule.php:170
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::columns() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:171
Constant reads 4
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Assignment\RowAssignment::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Assignment/RowAssignment.php:46
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertRows::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/InsertRows.php:72
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertSelect::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/InsertSelect.php:77
- class-const SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge\MergeInsert::__construct() packages/sql-semantics-postgres/src/Statement/Manipulation/Merge/MergeInsert.php:53
Type declarations 5
- type SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\ChangeRule packages/sql-semantics-postgres/src/Lowering/Manipulation/ChangeRule.php:163
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Assignments packages/sql-semantics-postgres/src/Rules/Manipulation/Assignments.php:90
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Assignments packages/sql-semantics-postgres/src/Rules/Manipulation/Assignments.php:116
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\GeneratedWrites::targets() packages/sql-semantics-postgres/src/Rules/Manipulation/GeneratedWrites.php:132
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Assignment\Assignment packages/sql-semantics-postgres/src/Statement/Manipulation/Assignment/Assignment.php:32