final class TableQuery
    implements Statement, Query, Selection, OutputNaming
    uses Snapshot
Public API: explicitly declared with @visibility public.

TABLE name: every row and column of one table, the same as SELECT * FROM name.

Rule: PG-TABLE-QUERY-001. The table is one FROM item without alias; the output is every column of it, and the ORDER BY, LIMIT and locking clauses written after it see its columns as a selection would. Source: https://www.postgresql.org/docs/17/sql-select.html#SQL-TABLE. Status: Implemented.

Reading a TABLE querydoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('TABLE ONLY s.t');
    [$query->singleNamedInput()->name()->name->value, $query->singleNamedInput()->table->only, $query->toString()] // => ['t', true, 'TABLE ONLY s.t']
Refusing a table with an aliasdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Query\TableQuery(new \SqlSemantics\Platform\PostgreSql\Statement\Relation\TableInput(new \SqlSemantics\Platform\PostgreSql\Statement\Name\RelationReference(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\QualifiedName(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('t'))), new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('x'))) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public TableInput $table
public SelectOptions|null $options = null

Methods§

public function __construct(public TableInput $table, public SelectOptions|null $options = null)

Parameters

$tableTableInputThe table, without alias or sample
$optionsSelectOptions|nullThe ORDER BY, LIMIT and locking clauses written after it
Calls 1
public function input(): Relation

Answers the table.

Returns

public function outputName(): ?Name

Answers no name: the output starts with the columns of the table.

Returns

public function deriveStatement(Derivation $derivation): void

Derives the query as a statement root.

Parameters

$derivationDerivation
Calls 2
public function deriveQuery(Derivation $derivation, Environment $outer): QueryFact

Derives the table and the output columns.

Parameters

$derivationDerivation
$outerEnvironment

Returns

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

Writes TABLE, the table and the options.

Parameters

$outOutput
Calls 1

Test cases 2§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 1
Type checks 6
Type declarations 1