classCreatePublication
final class CreatePublication
implements Statement
uses Snapshot
Public API: explicitly declared with
@visibility public.A request to create a publication.
Rule: PG-PUBLICATION-001. Mirrors CreatePublicationStmt: name, either FOR ALL TABLES or the object list (or neither), and the publication parameters. The tables of the list are relation occurrences (PG-PUBLICATION-TABLE-001); the list is read and checked by PG-PUBLICATION-LIST-001. Source: https://www.postgresql.org/docs/17/sql-createpublication.html. Status: Implemented.
$operation = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("CREATE PUBLICATION p FOR ALL TABLES WITH (publish = 'insert')");
[$operation->statement->allTables, $operation->toString()] // => [true, "CREATE PUBLICATION p FOR ALL TABLES WITH (publish = 'insert')"]Properties§
public list<PublicationMember> $objectspublic list<Definition> $optionspublic Name $namepublic bool $allTables = falseMethods§
public function __construct(
public Name $name,
public bool $allTables = false,
list<PublicationMember> $objects = [],
list<Definition> $options = [],
)Parameters
$name | Name | The publication name |
$allTables | bool | Whether FOR ALL TABLES is written |
$objects | list<PublicationMember> | The tables and schemas in the order written; empty with FOR ALL TABLES |
$options | list<Definition> | The publication parameters |
Calls 6
- static-call Check::listOf() line 54
- class-const PublicationMember::class() line 54
- class-const Definition::class() line 55
- static-call Check::input() line 56
- method-call PublicationList::check() line 57
- new PublicationList line 57
public function deriveStatement(Derivation $derivation): voidDerives the published tables and the parameters and checks the list.
Parameters
$derivation | Derivation |
Calls 4
- method-call PublicationList::derive() line 65
- new PublicationList line 65
- method-call ClauseFacts::derive() line 66
- new ClauseFacts line 66
public function render(Output $out): voidWrites the request.
Parameters
$out | Output |
Calls 2
- method-call Output::keyword() line 74
- class-const NameUse::Column() line 74
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 2
Other tests reaching this symbol 5
PublicationMemberTest::testIntroducedOfABareNamecallsPublicationSchemaTest::testRenderReadsABareNameAfterASchemaAsASchemacallsPublicationTableTest::testBareOfAContinuedNamecallsPublicationTableTest::testDeriveRelationResolvesTheTablecallsPublicationTableTest::testIntroducedWhenTableIsWrittencalls
Relations§
Instantiated in 3
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\PublicationRule::statement() packages/sql-semantics-postgres/src/Lowering/Catalog/PublicationRule.php:61
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\PublicationRule::statement() packages/sql-semantics-postgres/src/Lowering/Catalog/PublicationRule.php:62
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\PublicationRule::statement() packages/sql-semantics-postgres/src/Lowering/Catalog/PublicationRule.php:63