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

A request to install an extension.

Rule: PG-EXTENSION-001. Mirrors CreateExtensionStmt. The options are kept in the order written; the optional WITH is not kept. An option given twice is a diagnostic, and so is FROM, which the server no longer supports. Source: https://www.postgresql.org/docs/17/sql-createextension.html. Status: Implemented.

Installing an extension into a schemadoctest
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA ext CASCADE');
    [$operation->statement->ifNotExists, $operation->toString()] // => [true, 'CREATE EXTENSION IF NOT EXISTS hstore SCHEMA ext CASCADE']

Properties§

public list<ExtensionOption> $options
public Name $name
public bool $ifNotExists = false

Methods§

public function __construct(
    public Name $name,
    public bool $ifNotExists = false,
    list<ExtensionOption> $options = [],
)

Parameters

$nameNameThe extension name
$ifNotExistsboolWhether IF NOT EXISTS is written
$optionslist<ExtensionOption>The options in the order written
Calls 2
public function deriveStatement(Derivation $derivation): void

Reports repeated options and the unsupported FROM.

Parameters

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

Writes the request.

Parameters

$outOutput
Calls 4

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 2