final class CreateTarget
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

The new table of CREATE TABLE AS: its name, column names and storage.

Mirrors PostgreSQL's IntoClause as create_as_target builds it (rel, colNames, accessMethod, options, onCommit, tableSpaceName). The column names rename the first columns of the query; WITHOUT OIDS is a no-op and is not kept. Source: https://www.postgresql.org/docs/17/sql-createtableas.html.

Reading the target of CREATE TABLE ASdoctest
$create = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE TABLE t (x) USING heap WITH (fillfactor = 50) TABLESPACE s AS SELECT 1');
    [$create->statement->target->columns[0]->value, $create->statement->target->method->value] // => ['x', 'heap']

Properties§

public list<Name> $columns
public list<Definition> $options
public Name|null $method = null
public OnCommit|null $onCommit = null
public Name|null $tablespace = null

Methods§

public function __construct(
    public QualifiedName $name,
    list<Name> $columns = [],
    public Name|null $method = null,
    list<Definition> $options = [],
    public OnCommit|null $onCommit = null,
    public Name|null $tablespace = null,
)

Parameters

$nameQualifiedNameThe table name
$columnslist<Name>The column names
$methodName|nullThe table access method
$optionslist<Definition>The storage parameters
$onCommitOnCommit|nullThe ON COMMIT action
$tablespaceName|nullThe tablespace
Calls 3
public function render(Output $out): void

Writes the target.

Parameters

$outOutput
Calls 6

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 declarations 3