Create publications for the tables. The publications pub2
- and pub3a disallow some publish
+ and pub3a disallow some
+ publish
operations. The publication pub3b has a row filter (see
).
If the publication contains a partitioned table, the publication parameter
- publish_via_partition_root determines which row filter
- is used. If publish_via_partition_root is true ,
- the root partitioned table's row filter is used. Otherwise,
- if publish_via_partition_root is false
- (default), each partition's row filter is used.
+ publish_via_partition_root
+ determines which row filter is used. If publish_via_partition_root
+ is true , the root partitioned table's
+ row filter is used. Otherwise, if publish_via_partition_root
+ is false (default), each partition's
+ row filter is used.
Because initial data synchronization does not take into account the
- publish parameter when copying existing table data,
- some rows may be copied that would not be replicated using DML. Refer to
+ publish
+ parameter when copying existing table data, some rows may be copied that
+ would not be replicated using DML. Refer to
, and see
for examples.
If the subscription has several publications in which the same table has
- been published with different row filters (for the same publish
+ been published with different row filters (for the same
+ publish
operation), those expressions get ORed together, so that rows satisfying
any of the expressions will be replicated. This means all
the other row filters for the same table become redundant if:
- One of the publications was created using FOR ALL TABLES .
+ One of the publications was created using
+ FOR ALL TABLES .
This clause does not allow row filters.
One of the publications was created using
- FOR TABLES IN SCHEMA and the table belongs to
- the referred schema. This clause does not allow row filters.
+ FOR TABLES IN SCHEMA
+ and the table belongs to the referred schema. This clause does not allow
+ row filters.
The following examples show how the publication parameter
-
teral>publish_via_partition_root determines whether the row
- filter of the parent or child table will be used in the case of partition ed
- tables.
+
nk linkend="sql-createpublication-with-publish-via-partition-root">publish_via_partition_root
+ determines whether the row filter of the parent or child table will be us ed
+ in the case of partitioned tables.
Specifying a column list when the publication also publishes
- FOR TABLES IN SCHEMA is not supported.
+ FOR TABLES IN SCHEMA
+ is not supported.
For partitioned tables, the publication parameter
-
teral>publish_via_partition_root determines which column list
- is used. If publish_via_partition_root is
- true , the root partitioned table's column list is used.
- Otherwise, if publish_via_partition_root is
+
nk linkend="sql-createpublication-with-publish-via-partition-root">publish_via_partition_root
+ determines which column list is used. If publish_via_partition_root
+ is true , the root partitioned table's column list is
+ used. Otherwise, if publish_via_partition_root is
false (the default), each partition's column list is used.
tables.) Publications can also specify that changes are to be replicated
using the identity and schema of the partitioned root table instead of
that of the individual leaf partitions in which the changes actually
- originate (see CREATE PUBLICATION ).
+ originate (see
+ publish_via_partition_root
+ parameter of CREATE PUBLICATION ).
- The publication publish parameter only affects what
- DML operations will be replicated. The initial data synchronization does
- not take this parameter into account when copying the existing table data.
+ The publication
+ publish
+ parameter only affects what DML operations will be replicated. The
+ initial data synchronization does not take this parameter into account
+ when copying the existing table data.
and TRIGGER privilege on such tables to trusted roles.
Moreover, if untrusted users can create tables, use only
publications that list tables explicitly. That is to say, create a
- subscription FOR ALL TABLES or
- FOR TABLES IN SCHEMA only when superusers trust
- every user permitted to create a non-temp table on the publisher or the
- subscriber.
+ subscription
+ FOR ALL TABLES
+ or FOR TABLES IN SCHEMA
+ only when superusers trust every user permitted to create a non-temp table
+ on the publisher or the subscriber.
ALTER SUBSCRIPTION ... REFRESH PUBLICATION action on the
subscribing side in order to become effective. Note also that
DROP TABLES IN SCHEMA will not drop any schema tables
- that were specified using FOR TABLE /
+ that were specified using
+ FOR TABLE /
ADD TABLE , and the combination of DROP
with a WHERE clause is not allowed.
To alter the owner, you must be able to SET ROLE to the
new owning role, and that role must have CREATE
privilege on the database.
- Also, the new owner of a FOR ALL TABLES or
- FOR TABLES IN SCHEMA
+ Also, the new owner of a
+ FOR ALL TABLES
+ or FOR TABLES IN SCHEMA
publication must be a superuser. However, a superuser can
change the ownership of a publication regardless of these restrictions.
the case of different WHERE clauses, if one of the
publications has no WHERE clause (referring to that
publish operation) or the publication is declared as
- FOR ALL TABLES or
- FOR TABLES IN SCHEMA , rows are always published
- regardless of the definition of the other expressions.
- If the subscriber is a
PostgreSQL version before
- 15, then any row filtering is ignored during the initial data synchronization
- phase. For this case, the user might want to consider deleting any initially
- copied data that would be incompatible with subsequent filtering.
- Because initial data synchronization does not take into account the publication
- publish parameter when copying existing table data, some rows
- may be copied that would not be replicated using DML. See
+ FOR ALL TABLES
+ or FOR TABLES IN SCHEMA ,
+ rows are always published regardless of the definition of the other
+ expressions. If the subscriber is a
PostgreSQL
+ version before 15, then any row filtering is ignored during the initial data
+ synchronization phase. For this case, the user might want to consider
+ deleting any initially copied data that would be incompatible with
+ subsequent filtering. Because initial data synchronization does not take
+ into account the publication
+ publish
+ parameter when copying existing table data, some rows may be copied that
+ would not be replicated using DML. See
for examples.