classPublicationTable
final class PublicationTable
implements PublicationMember, Relation
uses Snapshot
@visibility public.A table as an item of a publication: [ TABLE ] [ ONLY ] name [ * ] [ ( column, ... ) ] [ WHERE ( expression ) ].
Mirrors PublicationObjSpec of type TABLE with its PublicationTable. The table is a relation occurrence: its name is resolved, the column list names its columns and the row filter sees its row (PG-PUBLICATION-TABLE-001). A trailing * changes nothing, but marks a bare name continuing a list as a table, so it is kept. Source: https://www.postgresql.org/docs/17/sql-createpublication.html.
$semantics = new \SqlSemantics\Platform\PostgreSql\Semantics();
$profile = new \SqlSemantics\Platform\PostgreSql\Model\Contract\LanguageProfile(\SqlSemantics\Platform\PostgreSql\Model\Contract\GrammarRelease::PostgreSql172);
$t = new \SqlSemantics\Platform\PostgreSql\Model\Statement\Declaration\Table(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\QualifiedName(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('t')), $profile, [new \SqlSemantics\Platform\PostgreSql\Model\Statement\Declaration\Column(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a'), \SqlSemantics\Platform\PostgreSql\Statement\Type\Descriptor\Builtin::Int4)]);
$operation = $semantics->analyze('CREATE PUBLICATION p FOR TABLE t (a) WHERE (a > 0)', [$t]);
[$operation->facts->relation($operation->statement->objects[0])->table->table === $t, $operation->facts->diagnostics] // => [true, []]Properties§
public list<Name> $columnspublic RelationReference $tablepublic Scalar|null $where = nullpublic bool $keyword = truepublic bool $star = falseMethods§
public function __construct(
public RelationReference $table,
list<Name> $columns = [],
public Scalar|null $where = null,
public bool $keyword = true,
public bool $star = false,
)Parameters
$table | RelationReference | The table |
$columns | list<Name> | The published columns; empty for every column |
$where | Scalar|null | The row filter, when WHERE is written |
$keyword | bool | Whether TABLE is written |
$star | bool | Whether a trailing `*` is written |
Calls 3
- static-call Check::listOf() line 56
- class-const Name::class() line 56
- static-call Check::input() line 57
public function introduced(): boolTells whether TABLE is written.
Returns
boolpublic function bare(): boolTells whether the item is a bare name, which a list reads as the kind of the item before it.
Returns
boolTest cases 1
public function deriveRelation(Derivation $derivation, Environment $environment): RelationFactResolves the table, checks the column list and derives the row filter.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 2
- method-call PublishedTables::derive() line 81
- new PublishedTables line 81
public function render(Output $out): voidWrites the item.
Parameters
$out | Output |
Calls 5
- method-call Output::keyword() line 90
- method-call Output::node() line 92
- method-call Output::symbol() line 94
- method-call Output::name() line 102
- class-const NameUse::Column() line 102
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 3
Other tests reaching this symbol 3
Relations§
Instantiated in 4
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\PublicationRule::object() packages/sql-semantics-postgres/src/Lowering/Catalog/PublicationRule.php:101
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\PublicationRule::object() packages/sql-semantics-postgres/src/Lowering/Catalog/PublicationRule.php:105
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\PublicationRule::object() packages/sql-semantics-postgres/src/Lowering/Catalog/PublicationRule.php:111
- new SqlSemantics\Platform\PostgreSql\Lowering\Catalog\PublicationRule::continued() packages/sql-semantics-postgres/src/Lowering/Catalog/PublicationRule.php:129
Type checks 5
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublicationList::check() packages/sql-semantics-postgres/src/Rules/Catalog/PublicationList.php:51
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublicationList::derive() packages/sql-semantics-postgres/src/Rules/Catalog/PublicationList.php:67
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublicationList::rule() packages/sql-semantics-postgres/src/Rules/Catalog/PublicationList.php:87
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublicationList::rule() packages/sql-semantics-postgres/src/Rules/Catalog/PublicationList.php:89
- instanceof SqlSemantics\Platform\PostgreSql\Rules\Catalog\PublicationList::rule() packages/sql-semantics-postgres/src/Rules/Catalog/PublicationList.php:96