final class QueryTables
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Derives the declaration of a relation defined by a query: CREATE TABLE AS, CREATE VIEW, CREATE MATERIALIZED VIEW.

Rule: PG-QUERY-TABLE-001. The relation has one column per output column of the query, in order; the written column names rename the first columns, and more names than columns is an error. A column of type unknown (an untyped string constant) is text. The columns of a table made by CREATE TABLE AS have no constraints and can be NULL; the columns of a view or a materialized view hold exactly the rows of the query and keep its NULL facts. A column whose type depends on declarations the context does not hold is declared with the type those inputs settle (PG-DECLARED-TYPE-001); the declaration is complete only up to the first output whose name or position the context cannot know (an open row) or whose type is invalid. A temporary relation with an unqualified name belongs to pg_temp. Tables and materialized views have the system columns; views do not. The declaration states the kind of the relation (PG-RELATION-KIND-001). Two columns of one name are an error. Source: https://www.postgresql.org/docs/17/sql-createtableas.html, https://www.postgresql.org/docs/17/sql-createview.html, https://www.postgresql.org/docs/17/sql-creatematerializedview.html. Termination: one pass over the output columns. Status: Implemented.

Methods§

public function table(
    Derivation $derivation,
    QualifiedName $name,
    QueryFact $fact,
    list<Name> $names,
    RelationKind $kind,
    DefinitionRule $tooMany = DefinitionRule::TableColumnCount,
): Table

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 5
Method calls 8