From 790bf615ddba8a0ba3b870915d03438ce9cb7860 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Thu, 22 Sep 2022 19:02:25 +0200 Subject: Remove ALL keyword from TABLES IN SCHEMA for publication This may be a bit too subtle, but removing that word from there makes this clause no longer a perfect parallel of the GRANT variant "ALL TABLES IN SCHEMA": indeed, for publications what we record is the schema itself, not the tables therein, which means that any tables added to the schema in the future are also published. This is completely different to what GRANT does, which is affect only the tables that exist when the command is executed. There isn't resounding support for this change, but there are a few positive votes and no opposition. Because the time to 15 RC1 is very short, let's get this out now. Backpatch to 15. Discussion: https://postgr.es/m/2729c9e2-9aac-8cda-f2f4-34f2bcc18f4e --- doc/src/sgml/logical-replication.sgml | 4 ++-- doc/src/sgml/ref/alter_publication.sgml | 16 ++++++++-------- doc/src/sgml/ref/create_publication.sgml | 14 +++++++------- doc/src/sgml/ref/create_subscription.sgml | 2 +- doc/src/sgml/system-views.sgml | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index 48fd8e33dcc..7fe3a1043e6 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -700,7 +700,7 @@ test_sub=# SELECT * FROM t3; one of the publications was created using - FOR ALL TABLES IN SCHEMA and the table belongs to + FOR TABLES IN SCHEMA and the table belongs to the referred schema. This clause does not allow row filters. @@ -1530,7 +1530,7 @@ CONTEXT: processing remote data for replication origin "pg_16395" during "INSER 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 ALL TABLES IN SCHEMA only when superusers trust + FOR TABLES IN SCHEMA only when superusers trust every user permitted to create a non-temp table on the publisher or the subscriber. diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml index d8ed89ee917..fc2d6d4885f 100644 --- a/doc/src/sgml/ref/alter_publication.sgml +++ b/doc/src/sgml/ref/alter_publication.sgml @@ -31,7 +31,7 @@ ALTER PUBLICATION name RENAME TO where publication_object is one of: TABLE [ ONLY ] table_name [ * ] [ ( column_name [, ... ] ) ] [ WHERE ( expression ) ] [, ... ] - ALL TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ] + TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ] @@ -71,19 +71,19 @@ ALTER PUBLICATION name RENAME TO You must own the publication to use ALTER PUBLICATION. Adding a table to a publication additionally requires owning that table. - The ADD ALL TABLES IN SCHEMA and - SET ALL TABLES IN SCHEMA to a publication requires the + The ADD TABLES IN SCHEMA and + SET TABLES IN SCHEMA to a publication requires the invoking user to be a superuser. To alter the owner, you must also be a direct or indirect member of the new owning role. The new owner must have CREATE privilege on the database. Also, the new owner - of a FOR ALL TABLES or FOR ALL TABLES IN - SCHEMA publication must be a superuser. However, a superuser can + 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. Adding/Setting a table that is part of schema specified in - ALL TABLES IN SCHEMA, adding/setting a schema to a + TABLES IN SCHEMA, adding/setting a schema to a publication that already has a table that is part of the specified schema or adding/setting a table to a publication that already has a table's schema as part of the specified schema is not supported. @@ -200,7 +200,7 @@ ALTER PUBLICATION mypublication SET TABLE users (user_id, firstname, lastname), sales to the publication sales_publication: -ALTER PUBLICATION sales_publication ADD ALL TABLES IN SCHEMA marketing, sales; +ALTER PUBLICATION sales_publication ADD TABLES IN SCHEMA marketing, sales; @@ -210,7 +210,7 @@ ALTER PUBLICATION sales_publication ADD ALL TABLES IN SCHEMA marketing, sales; production to the publication production_publication: -ALTER PUBLICATION production_publication ADD TABLE users, departments, ALL TABLES IN SCHEMA production; +ALTER PUBLICATION production_publication ADD TABLE users, departments, TABLES IN SCHEMA production; diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml index 0a68c4bf734..2e097a81e52 100644 --- a/doc/src/sgml/ref/create_publication.sgml +++ b/doc/src/sgml/ref/create_publication.sgml @@ -29,7 +29,7 @@ CREATE PUBLICATION name where publication_object is one of: TABLE [ ONLY ] table_name [ * ] [ ( column_name [, ... ] ) ] [ WHERE ( expression ) ] [, ... ] - ALL TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ] + TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ] @@ -112,7 +112,7 @@ CREATE PUBLICATION name Specifying a table that is part of a schema specified by - FOR ALL TABLES IN SCHEMA is not supported. + FOR TABLES IN SCHEMA is not supported. @@ -128,7 +128,7 @@ CREATE PUBLICATION name - FOR ALL TABLES IN SCHEMA + FOR TABLES IN SCHEMA Marks the publication as one that replicates changes for all tables in @@ -224,7 +224,7 @@ CREATE PUBLICATION name If FOR TABLE, FOR ALL TABLES or - FOR ALL TABLES IN SCHEMA are not specified, then the + FOR TABLES IN SCHEMA are not specified, then the publication starts out with an empty set of tables. That is useful if tables or schemas are to be added later. @@ -243,7 +243,7 @@ CREATE PUBLICATION name To add a table to a publication, the invoking user must have ownership rights on the table. The FOR ALL TABLES and - FOR ALL TABLES IN SCHEMA clauses require the invoking + FOR TABLES IN SCHEMA clauses require the invoking user to be a superuser. @@ -354,7 +354,7 @@ CREATE PUBLICATION insert_only FOR TABLE mydata all changes for all the tables present in the schema production: -CREATE PUBLICATION production_publication FOR TABLE users, departments, ALL TABLES IN SCHEMA production; +CREATE PUBLICATION production_publication FOR TABLE users, departments, TABLES IN SCHEMA production; @@ -363,7 +363,7 @@ CREATE PUBLICATION production_publication FOR TABLE users, departments, ALL TABL the schemas marketing and sales: -CREATE PUBLICATION sales_publication FOR ALL TABLES IN SCHEMA marketing, sales; +CREATE PUBLICATION sales_publication FOR TABLES IN SCHEMA marketing, sales; diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index 4e001f81119..bd12e71e336 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -372,7 +372,7 @@ CREATE SUBSCRIPTION subscription_nameWHERE clause (referring to that publish operation) or the publication is declared as FOR ALL TABLES or - FOR ALL TABLES IN SCHEMA, rows are always published + 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 diff --git a/doc/src/sgml/system-views.sgml b/doc/src/sgml/system-views.sgml index 3f573a4f089..1ca7c3f9bfc 100644 --- a/doc/src/sgml/system-views.sgml +++ b/doc/src/sgml/system-views.sgml @@ -2090,7 +2090,7 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx tables they contain. Unlike the underlying catalog pg_publication_rel, this view expands publications defined as FOR ALL TABLES - and FOR ALL TABLES IN SCHEMA, so for such publications + and FOR TABLES IN SCHEMA, so for such publications there will be a row for each eligible table. -- cgit v1.2.3