classTableQuery
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.
$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']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\InvalidConstructionProperties§
public TableInput $tablepublic SelectOptions|null $options = nullMethods§
public function __construct(public TableInput $table, public SelectOptions|null $options = null)Parameters
$table | TableInput | The table, without alias or sample |
$options | SelectOptions|null | The ORDER BY, LIMIT and locking clauses written after it |
Calls 1
- static-call Check::input() line 49
public function outputName(): ?NameAnswers no name: the output starts with the columns of the table.
Returns
?Namepublic function deriveStatement(Derivation $derivation): voidDerives the query as a statement root.
Parameters
$derivation | Derivation |
Calls 2
- method-call QueryRoots::derive() line 73
- new QueryRoots line 73
public function deriveQuery(Derivation $derivation, Environment $outer): QueryFactDerives the table and the output columns.
Parameters
$derivation | Derivation | |
$outer | Environment |
Returns
Calls 2
- method-call SelectFacts::table() line 81
- new SelectFacts line 81
public function render(Output $out): voidWrites TABLE, the table and the options.
Parameters
$out | Output |
Calls 1
- method-call Output::keyword() line 89
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
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Manipulation\Sources::statement() packages/sql-semantics-postgres/src/Rules/Manipulation/Sources.php:34
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::derive() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:50
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Query\Facts\QueryExpressionFacts::merged() packages/sql-semantics-postgres/src/Rules/Query/Facts/QueryExpressionFacts.php:84
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Query\QueryExpression::__construct() packages/sql-semantics-postgres/src/Statement/Query/QueryExpression.php:53
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Query\QueryExpression::__construct() packages/sql-semantics-postgres/src/Statement/Query/QueryExpression.php:56
- instanceof SqlSemantics\Platform\PostgreSql\Statement\Query\SetOperation::__construct() packages/sql-semantics-postgres/src/Statement/Query/SetOperation.php:56