final class CreateDatabase
    implements Statement
    uses Snapshot
Public API: explicitly declared with @visibility public.

A request to create a database.

Rule: PG-CREATEDB-001. Mirrors CreatedbStmt. The options are kept in the order written; the optional WITH before them is not kept. An option given twice or not recognized by the release is a diagnostic (PG-CATALOG-OPTION-001). A database is not a relation declaration: the statement provides none. Source: https://www.postgresql.org/docs/17/sql-createdatabase.html. Status: Implemented.

Reading the options of a new databasedoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("CREATE DATABASE d WITH OWNER = app ENCODING 'UTF8'");
    [$operation->statement->name->value, $operation->statement->options[1]->option(), $operation->toString()] // => ['d', 'encoding', "CREATE DATABASE d WITH OWNER = app ENCODING = 'UTF8'"]

Properties§

public list<DatabaseOption> $options
public Name $name

Methods§

public function __construct(public Name $name, list<DatabaseOption> $options = [])

Parameters

$nameNameThe database name
$optionslist<DatabaseOption>The options in the order written
Calls 2
public function deriveStatement(Derivation $derivation): void

Derives the option values and checks the option names.

Parameters

$derivationDerivation
Calls 4
public function render(Output $out): void

Writes the request.

Parameters

$outOutput
Calls 3

Test cases 3§

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 2

Relations§

Instantiated in 1