classCreateExtension
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.
$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> $optionspublic Name $namepublic bool $ifNotExists = falseMethods§
public function __construct(
public Name $name,
public bool $ifNotExists = false,
list<ExtensionOption> $options = [],
)Parameters
$name | Name | The extension name |
$ifNotExists | bool | Whether IF NOT EXISTS is written |
$options | list<ExtensionOption> | The options in the order written |
Calls 2
- static-call Check::listOf() line 47
- class-const ExtensionOption::class() line 47
public function deriveStatement(Derivation $derivation): voidReports repeated options and the unsupported FROM.
Parameters
$derivation | Derivation |
Calls 6
- method-call OptionChecks::redundant() line 59
- new OptionChecks line 59
- function-call
in_arrayline 60 - method-call Derivation::report() line 61
- new CatalogMisuse line 61
- class-const CatalogMisuseRule::ExtensionFrom() line 61
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 4
- method-call Output::keyword() line 70
- method-call Output::name() line 74
- class-const NameUse::Column() line 74
- method-call Output::node() line 76
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
CreateExtensionTestcalls
Relations§
Instantiated in 2
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\ExtensionRule::statement() packages/sql-semantics-postgres/src/Lowering/Catalog/ExtensionRule.php:95
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\ExtensionRule::statement() packages/sql-semantics-postgres/src/Lowering/Catalog/ExtensionRule.php:96