From 86164bf1bbfa12b8316ec9f77daed2f0703a6bc2 Mon Sep 17 00:00:00 2001 From: Vignesh C Date: Sun, 15 Mar 2026 16:47:13 +0530 Subject: [PATCH v63 2/2] Change syntax of CREATE PUBLICATION ... FOR ALL TABLES EXCEPT clause Change the syntax of CREATE PUBLICATION ... FOR ALL TABLES EXCEPT to move the TABLE keyword inside the relation list. Old syntax: CREATE PUBLICATION ... FOR ALL TABLES EXCEPT TABLE (t1 ...); New syntax: CREATE PUBLICATION ... FOR ALL TABLES EXCEPT (TABLE t1 ...); --- doc/src/sgml/ref/alter_publication.sgml | 4 ++-- doc/src/sgml/ref/create_publication.sgml | 6 +++--- src/backend/parser/gram.y | 6 +++--- src/bin/pg_dump/pg_dump.c | 2 +- src/bin/pg_dump/t/002_pg_dump.pl | 12 ++++++------ src/bin/psql/tab-complete.in.c | 22 +++++++++++----------- src/test/regress/expected/publication.out | 22 +++++++++++----------- src/test/regress/sql/publication.sql | 22 +++++++++++----------- src/test/subscription/t/037_except.pl | 8 ++++---- 9 files changed, 52 insertions(+), 52 deletions(-) diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml index c5e3dd3be77..9e2a4fdb6e4 100644 --- a/doc/src/sgml/ref/alter_publication.sgml +++ b/doc/src/sgml/ref/alter_publication.sgml @@ -36,7 +36,7 @@ ALTER PUBLICATION name RENAME TO where publication_except_tables is: - [ EXCEPT TABLE ( [ ONLY ] table_name [, ... ] ) ] + [ EXCEPT (TABLE [ ONLY ] table_name [, ... ] ) ] and publication_drop_object is one of: @@ -241,7 +241,7 @@ ALTER PUBLICATION mypublication SET TABLE users (user_id, firstname, lastname), Replace the publication's EXCEPT table list: -ALTER PUBLICATION mypublication SET ALL TABLES EXCEPT TABLE (users, departments); +ALTER PUBLICATION mypublication SET ALL TABLES EXCEPT (TABLE users, departments); diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml index 77066ef680b..97c18e5cf2f 100644 --- a/doc/src/sgml/ref/create_publication.sgml +++ b/doc/src/sgml/ref/create_publication.sgml @@ -32,7 +32,7 @@ CREATE PUBLICATION name and publication_all_object is one of: - ALL TABLES [ EXCEPT TABLE ( except_table_object [, ... ] ) ] + ALL TABLES [ EXCEPT (TABLE except_table_object [, ... ] ) ] ALL SEQUENCES and table_and_columns is: @@ -532,7 +532,7 @@ CREATE PUBLICATION all_tables_sequences FOR ALL TABLES, ALL SEQUENCES; Create a publication that publishes all changes in all tables except users and departments: -CREATE PUBLICATION all_tables_except FOR ALL TABLES EXCEPT TABLE (users, departments); +CREATE PUBLICATION all_tables_except FOR ALL TABLES EXCEPT (TABLE users, departments); @@ -541,7 +541,7 @@ CREATE PUBLICATION all_tables_except FOR ALL TABLES EXCEPT TABLE (users, departm all changes in all tables except users and departments: -CREATE PUBLICATION all_sequences_tables_except FOR ALL SEQUENCES, ALL TABLES EXCEPT TABLE (users, departments); +CREATE PUBLICATION all_sequences_tables_except FOR ALL SEQUENCES, ALL TABLES EXCEPT (TABLE users, departments); diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 63b62c89b13..85b0701de9e 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10802,7 +10802,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec * * pub_all_obj_type is one of: * - * TABLES [EXCEPT TABLE ( table [, ...] )] + * TABLES [EXCEPT (TABLE table [, ...] )] * SEQUENCES * * CREATE PUBLICATION FOR pub_obj [, ...] [WITH options] @@ -10945,7 +10945,7 @@ pub_obj_list: PublicationObjSpec ; opt_pub_except_clause: - EXCEPT TABLE '(' pub_except_obj_list ')' { $$ = $4; } + EXCEPT '(' TABLE pub_except_obj_list ')' { $$ = $4; } | /*EMPTY*/ { $$ = NIL; } ; @@ -10999,7 +10999,7 @@ pub_except_obj_list: PublicationExceptObjSpec * * ALTER PUBLICATION name SET pub_obj [, ...] * - * ALTER PUBLICATION name SET ALL TABLES [ EXCEPT TABLE ( table_name [, ...] ) ] + * ALTER PUBLICATION name SET ALL TABLES [ EXCEPT ( TABLE table_name [, ...] ) ] * * pub_obj is one of: * diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 137161aa5e0..76ff54ada97 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -4711,7 +4711,7 @@ dumpPublication(Archive *fout, const PublicationInfo *pubinfo) TableInfo *tbinfo = (TableInfo *) cell->ptr; if (++n_except == 1) - appendPQExpBufferStr(query, " EXCEPT TABLE ("); + appendPQExpBufferStr(query, " EXCEPT (TABLE "); else appendPQExpBufferStr(query, ", "); appendPQExpBuffer(query, "ONLY %s", fmtQualifiedDumpable(tbinfo)); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 6d1d38128fc..656f44eb519 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -3203,9 +3203,9 @@ my %tests = ( 'CREATE PUBLICATION pub8' => { create_order => 50, create_sql => - 'CREATE PUBLICATION pub8 FOR ALL TABLES EXCEPT TABLE (dump_test.test_table);', + 'CREATE PUBLICATION pub8 FOR ALL TABLES EXCEPT (TABLE dump_test.test_table);', regexp => qr/^ - \QCREATE PUBLICATION pub8 FOR ALL TABLES EXCEPT TABLE (ONLY dump_test.test_table) WITH (publish = 'insert, update, delete, truncate');\E + \QCREATE PUBLICATION pub8 FOR ALL TABLES EXCEPT (TABLE ONLY dump_test.test_table) WITH (publish = 'insert, update, delete, truncate');\E /xm, like => { %full_runs, section_post_data => 1, }, }, @@ -3213,9 +3213,9 @@ my %tests = ( 'CREATE PUBLICATION pub9' => { create_order => 50, create_sql => - 'CREATE PUBLICATION pub9 FOR ALL TABLES EXCEPT TABLE (dump_test.test_table, dump_test.test_second_table);', + 'CREATE PUBLICATION pub9 FOR ALL TABLES EXCEPT (TABLE dump_test.test_table, dump_test.test_second_table);', regexp => qr/^ - \QCREATE PUBLICATION pub9 FOR ALL TABLES EXCEPT TABLE (ONLY dump_test.test_table, ONLY dump_test.test_second_table) WITH (publish = 'insert, update, delete, truncate');\E + \QCREATE PUBLICATION pub9 FOR ALL TABLES EXCEPT (TABLE ONLY dump_test.test_table, ONLY dump_test.test_second_table) WITH (publish = 'insert, update, delete, truncate');\E /xm, like => { %full_runs, section_post_data => 1, }, }, @@ -3223,9 +3223,9 @@ my %tests = ( 'CREATE PUBLICATION pub10' => { create_order => 92, create_sql => - 'CREATE PUBLICATION pub10 FOR ALL TABLES EXCEPT TABLE (dump_test.test_inheritance_parent);', + 'CREATE PUBLICATION pub10 FOR ALL TABLES EXCEPT (TABLE dump_test.test_inheritance_parent);', regexp => qr/^ - \QCREATE PUBLICATION pub10 FOR ALL TABLES EXCEPT TABLE (ONLY dump_test.test_inheritance_parent, ONLY dump_test.test_inheritance_child) WITH (publish = 'insert, update, delete, truncate');\E + \QCREATE PUBLICATION pub10 FOR ALL TABLES EXCEPT (TABLE ONLY dump_test.test_inheritance_parent, ONLY dump_test.test_inheritance_child) WITH (publish = 'insert, update, delete, truncate');\E /xm, like => { %full_runs, section_post_data => 1, }, }, diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index 10a6b8f4284..89b9781b30c 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -2324,11 +2324,11 @@ match_previous_words(int pattern_id, else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET", "ALL")) COMPLETE_WITH("TABLES"); else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET", "ALL", "TABLES")) - COMPLETE_WITH("EXCEPT TABLE ("); + COMPLETE_WITH("EXCEPT ( TABLE"); else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET", "ALL", "TABLES", "EXCEPT")) - COMPLETE_WITH("TABLE ("); - else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET", "ALL", "TABLES", "EXCEPT", "TABLE")) - COMPLETE_WITH("("); + COMPLETE_WITH("( TABLE"); + else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET", "ALL", "TABLES", "EXCEPT", "(")) + COMPLETE_WITH("TABLE"); else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP|SET", "TABLES", "IN", "SCHEMA")) COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas " AND nspname NOT LIKE E'pg\\\\_%%'", @@ -3689,16 +3689,16 @@ match_previous_words(int pattern_id, else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL")) COMPLETE_WITH("TABLES", "SEQUENCES"); else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES")) - COMPLETE_WITH("EXCEPT TABLE (", "WITH ("); + COMPLETE_WITH("EXCEPT ( TABLE", "WITH ("); else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT")) - COMPLETE_WITH("TABLE ("); - else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "TABLE")) - COMPLETE_WITH("("); - else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "TABLE", "(")) + COMPLETE_WITH("( TABLE"); + else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "(")) + COMPLETE_WITH("TABLE"); + else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "(", "TABLE")) COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables); - else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "TABLE", "(", MatchAnyN) && ends_with(prev_wd, ',')) + else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "(", "TABLE", MatchAnyN) && ends_with(prev_wd, ',')) COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables); - else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "TABLE", "(", MatchAnyN) && !ends_with(prev_wd, ',')) + else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "EXCEPT", "(", "TABLE", MatchAnyN) && !ends_with(prev_wd, ',')) COMPLETE_WITH(")"); else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "TABLES")) COMPLETE_WITH("IN SCHEMA"); diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index 97a5288a728..dec338dd774 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -127,7 +127,7 @@ Tables from schemas: "pub_test" -- fail - SET ALL TABLES is not allowed for a 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable SET ALL TABLES EXCEPT TABLE (testpub_tbl1); +ALTER PUBLICATION testpub_fortable SET ALL TABLES EXCEPT (TABLE testpub_tbl1); ERROR: publication "testpub_fortable" does not support ALL TABLES operations DETAIL: This operation requires the publication to have been defined as FOR ALL TABLES. ALTER PUBLICATION testpub_fortable SET ALL TABLES; @@ -221,7 +221,7 @@ Not-null constraints: (1 row) -- fail - SET ALL TABLES is not allowed for a schema publication -ALTER PUBLICATION testpub_forschema SET ALL TABLES EXCEPT TABLE (pub_test.testpub_nopk); +ALTER PUBLICATION testpub_forschema SET ALL TABLES EXCEPT (TABLE pub_test.testpub_nopk); ERROR: publication "testpub_forschema" does not support ALL TABLES operations DETAIL: This operation requires the publication to have been defined as FOR ALL TABLES. ALTER PUBLICATION testpub_forschema SET ALL TABLES; @@ -232,7 +232,7 @@ DETAIL: This operation requires the publication to have been defined as FOR ALL --------------------------------------------- SET client_min_messages = 'ERROR'; -- Specify table list in the EXCEPT TABLE clause of a FOR ALL TABLES publication -CREATE PUBLICATION testpub_foralltables_excepttable FOR ALL TABLES EXCEPT TABLE (testpub_tbl1, testpub_tbl2); +CREATE PUBLICATION testpub_foralltables_excepttable FOR ALL TABLES EXCEPT (TABLE testpub_tbl1, testpub_tbl2); \dRp+ testpub_foralltables_excepttable Publication testpub_foralltables_excepttable Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Description @@ -243,7 +243,7 @@ Except tables: "public.testpub_tbl2" -- Specify table in the EXCEPT TABLE clause of a FOR ALL TABLES publication -CREATE PUBLICATION testpub_foralltables_excepttable1 FOR ALL TABLES EXCEPT TABLE (testpub_tbl1); +CREATE PUBLICATION testpub_foralltables_excepttable1 FOR ALL TABLES EXCEPT (TABLE testpub_tbl1); \dRp+ testpub_foralltables_excepttable1 Publication testpub_foralltables_excepttable1 Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Description @@ -278,7 +278,7 @@ ALTER PUBLICATION testpub_foralltables_excepttable SET ALL TABLES; (1 row) -- Replace the publication EXCEPT table list with a specific EXCEPT table. -ALTER PUBLICATION testpub_foralltables_excepttable SET ALL TABLES EXCEPT TABLE (testpub_tbl1); +ALTER PUBLICATION testpub_foralltables_excepttable SET ALL TABLES EXCEPT (TABLE testpub_tbl1); \dRp+ testpub_foralltables_excepttable Publication testpub_foralltables_excepttable Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Description @@ -317,7 +317,7 @@ Tables: "public.testpub_tbl_parent" -- List the parent table in the EXCEPT TABLE clause (without ONLY or '*') -CREATE PUBLICATION testpub5 FOR ALL TABLES EXCEPT TABLE (testpub_tbl_parent); +CREATE PUBLICATION testpub5 FOR ALL TABLES EXCEPT (TABLE testpub_tbl_parent); \dRp+ testpub5 Publication testpub5 Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Description @@ -328,7 +328,7 @@ Except tables: "public.testpub_tbl_parent" -- EXCEPT with '*': list the table and all its descendants in the EXCEPT TABLE clause -CREATE PUBLICATION testpub6 FOR ALL TABLES EXCEPT TABLE (testpub_tbl_parent *); +CREATE PUBLICATION testpub6 FOR ALL TABLES EXCEPT (TABLE testpub_tbl_parent *); \dRp+ testpub6 Publication testpub6 Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Description @@ -339,7 +339,7 @@ Except tables: "public.testpub_tbl_parent" -- EXCEPT with ONLY: list the table in the EXCEPT TABLE clause, but not its descendants -CREATE PUBLICATION testpub7 FOR ALL TABLES EXCEPT TABLE (ONLY testpub_tbl_parent); +CREATE PUBLICATION testpub7 FOR ALL TABLES EXCEPT (TABLE ONLY testpub_tbl_parent); \dRp+ testpub7 Publication testpub7 Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Description @@ -357,7 +357,7 @@ DROP PUBLICATION testpub3, testpub4, testpub5, testpub6, testpub7; SET client_min_messages = 'ERROR'; CREATE TABLE testpub_root(a int) PARTITION BY RANGE(a); CREATE TABLE testpub_part1 PARTITION OF testpub_root FOR VALUES FROM (0) TO (100); -CREATE PUBLICATION testpub8 FOR ALL TABLES EXCEPT TABLE (testpub_root); +CREATE PUBLICATION testpub8 FOR ALL TABLES EXCEPT (TABLE testpub_root); \dRp+ testpub8; Publication testpub8 Owner | All tables | All sequences | Inserts | Updates | Deletes | Truncates | Generated columns | Via root | Description @@ -385,7 +385,7 @@ Except Publications: "testpub8" Number of partitions: 1 (Use \d+ to list them.) -CREATE PUBLICATION testpub9 FOR ALL TABLES EXCEPT TABLE (testpub_part1); +CREATE PUBLICATION testpub9 FOR ALL TABLES EXCEPT (TABLE testpub_part1); ERROR: cannot use publication EXCEPT clause for relation "testpub_part1" DETAIL: This operation is not supported for individual partitions. CREATE TABLE tab_main (a int) PARTITION BY RANGE(a); @@ -1581,7 +1581,7 @@ RESET client_min_messages; ALTER PUBLICATION testpub5 OWNER TO regress_publication_user3; SET ROLE regress_publication_user3; -- fail - SET ALL TABLES on a publication requires superuser privileges -ALTER PUBLICATION testpub5 SET ALL TABLES EXCEPT TABLE (testpub_tbl1); -- fail +ALTER PUBLICATION testpub5 SET ALL TABLES EXCEPT (TABLE testpub_tbl1); -- fail ERROR: must be superuser to alter FOR ALL TABLES publication ALTER PUBLICATION testpub5 SET ALL TABLES; -- fail ERROR: must be superuser to alter FOR ALL TABLES publication diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql index 56e4bfba974..154b552efaf 100644 --- a/src/test/regress/sql/publication.sql +++ b/src/test/regress/sql/publication.sql @@ -75,7 +75,7 @@ ALTER PUBLICATION testpub_fortable SET TABLES IN SCHEMA pub_test; \dRp+ testpub_fortable -- fail - SET ALL TABLES is not allowed for a 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable SET ALL TABLES EXCEPT TABLE (testpub_tbl1); +ALTER PUBLICATION testpub_fortable SET ALL TABLES EXCEPT (TABLE testpub_tbl1); ALTER PUBLICATION testpub_fortable SET ALL TABLES; SET client_min_messages = 'ERROR'; @@ -110,7 +110,7 @@ SELECT pubname, puballtables FROM pg_publication WHERE pubname = 'testpub_forall \dRp+ testpub_foralltables -- fail - SET ALL TABLES is not allowed for a schema publication -ALTER PUBLICATION testpub_forschema SET ALL TABLES EXCEPT TABLE (pub_test.testpub_nopk); +ALTER PUBLICATION testpub_forschema SET ALL TABLES EXCEPT (TABLE pub_test.testpub_nopk); ALTER PUBLICATION testpub_forschema SET ALL TABLES; --------------------------------------------- @@ -118,10 +118,10 @@ ALTER PUBLICATION testpub_forschema SET ALL TABLES; --------------------------------------------- SET client_min_messages = 'ERROR'; -- Specify table list in the EXCEPT TABLE clause of a FOR ALL TABLES publication -CREATE PUBLICATION testpub_foralltables_excepttable FOR ALL TABLES EXCEPT TABLE (testpub_tbl1, testpub_tbl2); +CREATE PUBLICATION testpub_foralltables_excepttable FOR ALL TABLES EXCEPT (TABLE testpub_tbl1, testpub_tbl2); \dRp+ testpub_foralltables_excepttable -- Specify table in the EXCEPT TABLE clause of a FOR ALL TABLES publication -CREATE PUBLICATION testpub_foralltables_excepttable1 FOR ALL TABLES EXCEPT TABLE (testpub_tbl1); +CREATE PUBLICATION testpub_foralltables_excepttable1 FOR ALL TABLES EXCEPT (TABLE testpub_tbl1); \dRp+ testpub_foralltables_excepttable1 -- Check that the table description shows the publications where it is listed -- in the EXCEPT TABLE clause @@ -132,7 +132,7 @@ ALTER PUBLICATION testpub_foralltables_excepttable SET ALL TABLES; \dRp+ testpub_foralltables_excepttable -- Replace the publication EXCEPT table list with a specific EXCEPT table. -ALTER PUBLICATION testpub_foralltables_excepttable SET ALL TABLES EXCEPT TABLE (testpub_tbl1); +ALTER PUBLICATION testpub_foralltables_excepttable SET ALL TABLES EXCEPT (TABLE testpub_tbl1); \dRp+ testpub_foralltables_excepttable RESET client_min_messages; @@ -151,13 +151,13 @@ CREATE PUBLICATION testpub3 FOR TABLE testpub_tbl_parent; CREATE PUBLICATION testpub4 FOR TABLE ONLY testpub_tbl_parent; \dRp+ testpub4 -- List the parent table in the EXCEPT TABLE clause (without ONLY or '*') -CREATE PUBLICATION testpub5 FOR ALL TABLES EXCEPT TABLE (testpub_tbl_parent); +CREATE PUBLICATION testpub5 FOR ALL TABLES EXCEPT (TABLE testpub_tbl_parent); \dRp+ testpub5 -- EXCEPT with '*': list the table and all its descendants in the EXCEPT TABLE clause -CREATE PUBLICATION testpub6 FOR ALL TABLES EXCEPT TABLE (testpub_tbl_parent *); +CREATE PUBLICATION testpub6 FOR ALL TABLES EXCEPT (TABLE testpub_tbl_parent *); \dRp+ testpub6 -- EXCEPT with ONLY: list the table in the EXCEPT TABLE clause, but not its descendants -CREATE PUBLICATION testpub7 FOR ALL TABLES EXCEPT TABLE (ONLY testpub_tbl_parent); +CREATE PUBLICATION testpub7 FOR ALL TABLES EXCEPT (TABLE ONLY testpub_tbl_parent); \dRp+ testpub7 RESET client_min_messages; @@ -170,11 +170,11 @@ DROP PUBLICATION testpub3, testpub4, testpub5, testpub6, testpub7; SET client_min_messages = 'ERROR'; CREATE TABLE testpub_root(a int) PARTITION BY RANGE(a); CREATE TABLE testpub_part1 PARTITION OF testpub_root FOR VALUES FROM (0) TO (100); -CREATE PUBLICATION testpub8 FOR ALL TABLES EXCEPT TABLE (testpub_root); +CREATE PUBLICATION testpub8 FOR ALL TABLES EXCEPT (TABLE testpub_root); \dRp+ testpub8; \d testpub_part1 \d testpub_root -CREATE PUBLICATION testpub9 FOR ALL TABLES EXCEPT TABLE (testpub_part1); +CREATE PUBLICATION testpub9 FOR ALL TABLES EXCEPT (TABLE testpub_part1); CREATE TABLE tab_main (a int) PARTITION BY RANGE(a); -- Attaching a partition is not allowed if the partitioned table appears in a @@ -1013,7 +1013,7 @@ RESET client_min_messages; ALTER PUBLICATION testpub5 OWNER TO regress_publication_user3; SET ROLE regress_publication_user3; -- fail - SET ALL TABLES on a publication requires superuser privileges -ALTER PUBLICATION testpub5 SET ALL TABLES EXCEPT TABLE (testpub_tbl1); -- fail +ALTER PUBLICATION testpub5 SET ALL TABLES EXCEPT (TABLE testpub_tbl1); -- fail ALTER PUBLICATION testpub5 SET ALL TABLES; -- fail SET ROLE regress_publication_user; diff --git a/src/test/subscription/t/037_except.pl b/src/test/subscription/t/037_except.pl index cbfe42011ef..13bfa978356 100644 --- a/src/test/subscription/t/037_except.pl +++ b/src/test/subscription/t/037_except.pl @@ -31,7 +31,7 @@ sub test_except_root_partition # publish_via_partition_root setting. $node_publisher->safe_psql( 'postgres', qq( - CREATE PUBLICATION tap_pub_part FOR ALL TABLES EXCEPT TABLE (root1) WITH (publish_via_partition_root = $pubviaroot); + CREATE PUBLICATION tap_pub_part FOR ALL TABLES EXCEPT (TABLE root1) WITH (publish_via_partition_root = $pubviaroot); INSERT INTO root1 VALUES (1), (101); )); $node_subscriber->safe_psql('postgres', @@ -94,7 +94,7 @@ $node_subscriber->safe_psql( # to verify exclusion behavior for inherited tables, including the effect of # ONLY in the EXCEPT TABLE clause. $node_publisher->safe_psql('postgres', - "CREATE PUBLICATION tab_pub FOR ALL TABLES EXCEPT TABLE (tab1, parent, only parent1)" + "CREATE PUBLICATION tab_pub FOR ALL TABLES EXCEPT (TABLE tab1, parent, only parent1)" ); # Create a logical replication slot to help with later tests. @@ -158,7 +158,7 @@ $node_subscriber->safe_psql('postgres', "CREATE TABLE tab2 (a int)"); # Replace the EXCEPT TABLE list so that only tab2 is excluded. $node_publisher->safe_psql('postgres', - "ALTER PUBLICATION tab_pub SET ALL TABLES EXCEPT TABLE (tab2)"); + "ALTER PUBLICATION tab_pub SET ALL TABLES EXCEPT (TABLE tab2)"); # Refresh the subscription so the subscriber picks up the updated # publication definition and initiates table synchronization. @@ -231,7 +231,7 @@ test_except_root_partition('true'); # FOR TABLE. $node_publisher->safe_psql( 'postgres', qq( - CREATE PUBLICATION tap_pub1 FOR ALL TABLES EXCEPT TABLE (tab1); + CREATE PUBLICATION tap_pub1 FOR ALL TABLES EXCEPT (TABLE tab1); CREATE PUBLICATION tap_pub2 FOR TABLE tab1; INSERT INTO tab1 VALUES(1); )); -- 2.43.0