classCreateTarget
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.
$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> $columnspublic list<Definition> $optionspublic QualifiedName $namepublic Name|null $method = nullpublic OnCommit|null $onCommit = nullpublic Name|null $tablespace = nullMethods§
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
$name | QualifiedName | The table name |
$columns | list<Name> | The column names |
$method | Name|null | The table access method |
$options | list<Definition> | The storage parameters |
$onCommit | OnCommit|null | The ON COMMIT action |
$tablespace | Name|null | The tablespace |
Calls 3
- static-call Check::listOf() line 61
- class-const Name::class() line 61
- class-const Definition::class() line 62
public function render(Output $out): voidWrites the target.
Parameters
$out | Output |
Calls 6
- new Writing line 70
- method-call Spelling::qualified() line 71
- new Spelling line 71
- method-call Writing::parenthesized() line 73
- method-call Output::keyword() line 76
- method-call Writing::definitions() line 80
Test cases 2§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CreateTargetTestcalls
Other tests reaching this symbol 1
Relations§
Instantiated in 1
Type declarations 3
- type SqlSemantics\Platform\PostgreSql\Lowering\Table\CreateAsRule packages/sql-semantics-postgres/src/Lowering/Table/CreateAsRule.php:101
- type SqlSemantics\Platform\PostgreSql\Statement\Table\CreateTableAs packages/sql-semantics-postgres/src/Statement/Table/CreateTableAs.php:49
- type SqlSemantics\Platform\PostgreSql\Statement\Table\CreateTableAsExecute packages/sql-semantics-postgres/src/Statement/Table/CreateTableAsExecute.php:43