classTargetTable
final class TargetTable
implements NamedRelation
uses Snapshot
Public API: explicitly declared with
@visibility public.The table an INSERT, UPDATE, DELETE, MERGE or COPY writes to or reads from, with its correlation name.
Mirrors the relation RangeVar of PostgreSQL's InsertStmt, UpdateStmt, DeleteStmt, MergeStmt and CopyStmt. The facts follow PG-TARGET-TABLE-001. Source: https://www.postgresql.org/docs/17/sql-update.html. Status: Implemented.
$update = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('UPDATE ONLY app.t AS x SET a = 1');
[$update->statement->target->name()->schema?->value, $update->statement->target->table->only, $update->statement->target->alias()?->value] // => ['app', true, 'x']Properties§
public RelationReference $tablepublic Name|null $alias = nullMethods§
public function __construct(public RelationReference $table, public Name|null $alias = null)Parameters
$table | RelationReference | The table, with ONLY when its descendant tables are excluded |
$alias | Name|null | The correlation name |
public function name(): QualifiedNameAnswers the table name.
Returns
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactResolves the name among the declared relations and derives the row shape of the table.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 2
- method-call Targets::fact() line 65
- new Targets line 65
public function render(Output $out): voidWrites the table and the correlation name.
Parameters
$out | Output |
Calls 3
- method-call Output::node() line 73
- method-call AliasSpelling::write() line 74
- new AliasSpelling line 74
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
TargetTableTestcalls
Relations§
Instantiated in 6
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\ChangeRule::target() packages/sql-semantics-postgres/src/Lowering/Manipulation/ChangeRule.php:114
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\ChangeRule::target() packages/sql-semantics-postgres/src/Lowering/Manipulation/ChangeRule.php:115
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\ChangeRule::target() packages/sql-semantics-postgres/src/Lowering/Manipulation/ChangeRule.php:116
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\CopyRule::copy() packages/sql-semantics-postgres/src/Lowering/Manipulation/CopyRule.php:65
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::target() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:134
- new SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule::target() packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:135
Type checks 2
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Assignments::slot() packages/sql-semantics-postgres/src/Rules/Manipulation/Assignments.php:106
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\CopyFacts::columns() packages/sql-semantics-postgres/src/Rules/Manipulation/CopyFacts.php:148
Type declarations 12
- type SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\ChangeRule packages/sql-semantics-postgres/src/Lowering/Manipulation/ChangeRule.php:109
- type SqlSemantics\Platform\PostgreSql\Lowering\Manipulation\InsertRule packages/sql-semantics-postgres/src/Lowering/Manipulation/InsertRule.php:129
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\ModificationScope packages/sql-semantics-postgres/src/Rules/Manipulation/ModificationScope.php:46
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:33
- type SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Targets packages/sql-semantics-postgres/src/Rules/Manipulation/Targets.php:41
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Copy\CopyTable packages/sql-semantics-postgres/src/Statement/Manipulation/Copy/CopyTable.php:73
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Delete packages/sql-semantics-postgres/src/Statement/Manipulation/Delete.php:53
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertDefaults packages/sql-semantics-postgres/src/Statement/Manipulation/InsertDefaults.php:52
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertRows packages/sql-semantics-postgres/src/Statement/Manipulation/InsertRows.php:64
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\InsertSelect packages/sql-semantics-postgres/src/Statement/Manipulation/InsertSelect.php:68
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Merge packages/sql-semantics-postgres/src/Statement/Manipulation/Merge.php:63
- type SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Update packages/sql-semantics-postgres/src/Statement/Manipulation/Update.php:65