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.

Reading the table a statement writes todoctest
$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 Name|null $alias = null

Methods§

public function __construct(public RelationReference $table, public Name|null $alias = null)

Parameters

$tableRelationReferenceThe table, with ONLY when its descendant tables are excluded
$aliasName|nullThe correlation name
public function name(): QualifiedName

Answers the table name.

public function alias(): ?Name

Answers the correlation name.

Returns

public function deriveRelation(Derivation $derivation, Environment $environment): RelationFact

Resolves the name among the declared relations and derives the row shape of the table.

Parameters

$derivationDerivation
$environmentEnvironment
Calls 2
public function render(Output $out): void

Writes the table and the correlation name.

Parameters

$outOutput
Calls 3

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 6
Type checks 2
Type declarations 12