classSchemaMember
final class SchemaMember
implements Statement
An element of CREATE SCHEMA as the server reads it: created in the new schema, with that schema searched first.
Rule: PG-SCHEMA-ELEMENT-001. Scope: the schema_stmt elements of CreateSchemaStmt. The server sets the search path to the new schema followed by the previous path while it runs the elements ("the
- subcommands are treated essentially the same as separate commands issued
- after creating the schema, except that ... the search path is ... the new
- schema first"), so an unqualified name in an element finds an object of
the new schema before any other; the temporary schema and pg_catalog stay implicit before it. An unqualified object the element creates is declared in the new schema. The server does not run the elements in the order written: transformCreateSchemaStmtElements (parse_utilcmd.c) runs the sequences first, then the tables, views, indexes, triggers and grants, each group in the order written; an element sees the relations the elements run before it create. This value is a working value of one derivation: it stands for the element while the derivation runs under the other search settings and is not part of the published statement. Source: https://www.postgresql.org/docs/17/sql-createschema.html. Termination: one pass over the search path. Status: Implemented.
Constants§
public const STEPS = [\SqlSemantics\Platform\PostgreSql\Statement\Table\Sequence\CreateSequence::cla…The step each kind of element runs in; any other element (GRANT) runs last.
Methods§
public function step(): intAnswers the step the server runs the element in: a lower step runs before a higher one.
Returns
intTest cases 1
Called from 1
Calls 1
- class-const SchemaMember::STEPS() line 72
public function context(AnalysisContext $outer, list<Table> $provided = []): AnalysisContextAnswers the context the elements of a new schema are read in: the same declarations and those the statement already provided, with the schema searched before the written path.
Parameters
$outer | AnalysisContext | |
$provided | list<Table> | The relations the statement declared before this element |
Returns
Test cases 2
Calls 2
- function-call
in_arrayline 84 - new AnalysisContext line 101
public function deriveStatement(Derivation $derivation): voidDerives the element as a member of the schema; a statement that creates nothing in it is derived as it is.
Parameters
$derivation | Derivation |
Test cases 2
Calls 2
- method-call Statement::deriveElement() line 110
- method-call Derivation::statement() line 112
public function render(Output $out): voidPrivate surface 2§
Implementation details, listed for orientation only.
private Statement $elementprivate Name $schemaTest cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
SchemaMemberTest::testContextAddsTheRelationsTheStatementProvidedcallsSchemaMemberTest::testContextSearchesTheSchemaBeforeTheWrittenPathcallsSchemaMemberTest::testDeriveStatementDeclaresACreatedObjectInTheSchemacallsSchemaMemberTest::testDeriveStatementDerivesAnotherStatementAsItIscallsSchemaMemberTest::testRenderWritesTheElementcallsSchemaMemberTest::testStepRunsSequencesBeforeTablesAndGrantsLastcalls