On 2022-Sep-20, Robert Haas wrote: > > I don't think we should change this behavior that's already in logical > > replication. While I understand the reasons why "GRANT ... ALL TABLES IN > > SCHEMA" has a different behavior (i.e. it's not applied to future > > objects) and do not advocate to change it, I have personally been > > affected where I thought a permission would be applied to all future > > objects, only to discover otherwise. I believe it's more intuitive to > > think that "ALL" applies to "everything, always." > > Nah, there's room for multiple behaviors here. It's reasonable to want > to add all the tables currently in the schema to a publication (or > grant permissions on them) and it's reasonable to want to include all > current and future tables in the schema in a publication (or grant > permissions on them) too. The reason I don't like the ALL TABLES IN > SCHEMA syntax is that it sounds like the former, but actually is the > latter. Based on your link to the email from Tom, I understand now the > reason why it's like that, but it's still counterintuitive to me.
I already proposed elsewhere that we remove the ALL keyword from there, which I think serves to reduce confusion (in particular it's no longer parallel to the GRANT one). As in the attached. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "No renuncies a nada. No te aferres a nada."
>From a72ceafe65c02998761cf21bec2820bf49b00a8f Mon Sep 17 00:00:00 2001 From: Alvaro Herrera <alvhe...@alvh.no-ip.org> Date: Wed, 21 Sep 2022 16:18:16 +0200 Subject: [PATCH] remove ALL from ALL TABLES IN SCHEMA --- 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 +- src/backend/catalog/pg_publication.c | 4 +- src/backend/commands/publicationcmds.c | 6 +- src/backend/parser/gram.y | 18 +-- src/backend/replication/pgoutput/pgoutput.c | 3 +- src/bin/pg_dump/pg_dump.c | 2 +- src/bin/pg_dump/t/002_pg_dump.pl | 12 +- src/bin/psql/tab-complete.c | 14 +- src/test/regress/expected/alter_table.out | 2 +- src/test/regress/expected/object_address.out | 2 +- src/test/regress/expected/publication.out | 120 +++++++++--------- src/test/regress/sql/alter_table.sql | 2 +- src/test/regress/sql/object_address.sql | 2 +- src/test/regress/sql/publication.sql | 104 +++++++-------- .../t/025_rep_changes_for_schema.pl | 6 +- src/test/subscription/t/028_row_filter.pl | 12 +- src/test/subscription/t/031_column_list.pl | 4 +- 21 files changed, 175 insertions(+), 176 deletions(-) diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index 48fd8e33dc..7fe3a1043e 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -700,7 +700,7 @@ test_sub=# SELECT * FROM t3; <listitem> <para> one of the publications was created using - <literal>FOR ALL TABLES IN SCHEMA</literal> and the table belongs to + <literal>FOR TABLES IN SCHEMA</literal> and the table belongs to the referred schema. This clause does not allow row filters. </para> </listitem> @@ -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 <literal>FOR ALL TABLES</literal> or - <literal>FOR ALL TABLES IN SCHEMA</literal> only when superusers trust + <literal>FOR TABLES IN SCHEMA</literal> only when superusers trust every user permitted to create a non-temp table on the publisher or the subscriber. </para> diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml index d8ed89ee91..fc2d6d4885 100644 --- a/doc/src/sgml/ref/alter_publication.sgml +++ b/doc/src/sgml/ref/alter_publication.sgml @@ -31,7 +31,7 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r <phrase>where <replaceable class="parameter">publication_object</replaceable> is one of:</phrase> TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ ( <replaceable class="parameter">column_name</replaceable> [, ... ] ) ] [ WHERE ( <replaceable class="parameter">expression</replaceable> ) ] [, ... ] - ALL TABLES IN SCHEMA { <replaceable class="parameter">schema_name</replaceable> | CURRENT_SCHEMA } [, ... ] + TABLES IN SCHEMA { <replaceable class="parameter">schema_name</replaceable> | CURRENT_SCHEMA } [, ... ] </synopsis> </refsynopsisdiv> @@ -71,19 +71,19 @@ ALTER PUBLICATION <replaceable class="parameter">name</replaceable> RENAME TO <r <para> You must own the publication to use <command>ALTER PUBLICATION</command>. Adding a table to a publication additionally requires owning that table. - The <literal>ADD ALL TABLES IN SCHEMA</literal> and - <literal>SET ALL TABLES IN SCHEMA</literal> to a publication requires the + The <literal>ADD TABLES IN SCHEMA</literal> and + <literal>SET TABLES IN SCHEMA</literal> 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 <literal>CREATE</literal> privilege on the database. Also, the new owner - of a <literal>FOR ALL TABLES</literal> or <literal>FOR ALL TABLES IN - SCHEMA</literal> publication must be a superuser. However, a superuser can + of a <literal>FOR ALL TABLES</literal> or <literal>FOR TABLES IN SCHEMA</literal> + publication must be a superuser. However, a superuser can change the ownership of a publication regardless of these restrictions. </para> <para> Adding/Setting a table that is part of schema specified in - <literal>ALL TABLES IN SCHEMA</literal>, adding/setting a schema to a + <literal>TABLES IN SCHEMA</literal>, 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), <structname>sales</structname> to the publication <structname>sales_publication</structname>: <programlisting> -ALTER PUBLICATION sales_publication ADD ALL TABLES IN SCHEMA marketing, sales; +ALTER PUBLICATION sales_publication ADD TABLES IN SCHEMA marketing, sales; </programlisting> </para> @@ -210,7 +210,7 @@ ALTER PUBLICATION sales_publication ADD ALL TABLES IN SCHEMA marketing, sales; <structname>production</structname> to the publication <structname>production_publication</structname>: <programlisting> -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; </programlisting></para> </refsect1> diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml index 0a68c4bf73..2e097a81e5 100644 --- a/doc/src/sgml/ref/create_publication.sgml +++ b/doc/src/sgml/ref/create_publication.sgml @@ -29,7 +29,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable> <phrase>where <replaceable class="parameter">publication_object</replaceable> is one of:</phrase> TABLE [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] [ ( <replaceable class="parameter">column_name</replaceable> [, ... ] ) ] [ WHERE ( <replaceable class="parameter">expression</replaceable> ) ] [, ... ] - ALL TABLES IN SCHEMA { <replaceable class="parameter">schema_name</replaceable> | CURRENT_SCHEMA } [, ... ] + TABLES IN SCHEMA { <replaceable class="parameter">schema_name</replaceable> | CURRENT_SCHEMA } [, ... ] </synopsis> </refsynopsisdiv> @@ -112,7 +112,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable> <para> Specifying a table that is part of a schema specified by - <literal>FOR ALL TABLES IN SCHEMA</literal> is not supported. + <literal>FOR TABLES IN SCHEMA</literal> is not supported. </para> </listitem> </varlistentry> @@ -128,7 +128,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable> </varlistentry> <varlistentry> - <term><literal>FOR ALL TABLES IN SCHEMA</literal></term> + <term><literal>FOR TABLES IN SCHEMA</literal></term> <listitem> <para> Marks the publication as one that replicates changes for all tables in @@ -224,7 +224,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable> <para> If <literal>FOR TABLE</literal>, <literal>FOR ALL TABLES</literal> or - <literal>FOR ALL TABLES IN SCHEMA</literal> are not specified, then the + <literal>FOR TABLES IN SCHEMA</literal> 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. </para> @@ -243,7 +243,7 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable> <para> To add a table to a publication, the invoking user must have ownership rights on the table. The <command>FOR ALL TABLES</command> and - <command>FOR ALL TABLES IN SCHEMA</command> clauses require the invoking + <command>FOR TABLES IN SCHEMA</command> clauses require the invoking user to be a superuser. </para> @@ -354,7 +354,7 @@ CREATE PUBLICATION insert_only FOR TABLE mydata all changes for all the tables present in the schema <structname>production</structname>: <programlisting> -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; </programlisting> </para> @@ -363,7 +363,7 @@ CREATE PUBLICATION production_publication FOR TABLE users, departments, ALL TABL the schemas <structname>marketing</structname> and <structname>sales</structname>: <programlisting> -CREATE PUBLICATION sales_publication FOR ALL TABLES IN SCHEMA marketing, sales; +CREATE PUBLICATION sales_publication FOR TABLES IN SCHEMA marketing, sales; </programlisting></para> <para> diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index 4e001f8111..bd12e71e33 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -372,7 +372,7 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl publications has no <literal>WHERE</literal> clause (referring to that publish operation) or the publication is declared as <literal>FOR ALL TABLES</literal> or - <literal>FOR ALL TABLES IN SCHEMA</literal>, rows are always published + <literal>FOR TABLES IN SCHEMA</literal>, rows are always published regardless of the definition of the other expressions. If the subscriber is a <productname>PostgreSQL</productname> 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 3f573a4f08..1ca7c3f9bf 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 <link linkend="catalog-pg-publication-rel"><structname>pg_publication_rel</structname></link>, this view expands publications defined as <literal>FOR ALL TABLES</literal> - and <literal>FOR ALL TABLES IN SCHEMA</literal>, so for such publications + and <literal>FOR TABLES IN SCHEMA</literal>, so for such publications there will be a row for each eligible table. </para> diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c index 6af3570005..e27db27f04 100644 --- a/src/backend/catalog/pg_publication.c +++ b/src/backend/catalog/pg_publication.c @@ -837,7 +837,7 @@ GetAllTablesPublicationRelations(bool pubviaroot) /* * Gets the list of schema oids for a publication. * - * This should only be used FOR ALL TABLES IN SCHEMA publications. + * This should only be used FOR TABLES IN SCHEMA publications. */ List * GetPublicationSchemas(Oid pubid) @@ -957,7 +957,7 @@ GetSchemaPublicationRelations(Oid schemaid, PublicationPartOpt pub_partopt) } /* - * Gets the list of all relations published by FOR ALL TABLES IN SCHEMA + * Gets the list of all relations published by FOR TABLES IN SCHEMA * publication. */ List * diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c index 8b574b86c4..15ab5aa99e 100644 --- a/src/backend/commands/publicationcmds.c +++ b/src/backend/commands/publicationcmds.c @@ -847,11 +847,11 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt) ObjectsInPublicationToOids(stmt->pubobjects, pstate, &relations, &schemaidlist); - /* FOR ALL TABLES IN SCHEMA requires superuser */ + /* FOR TABLES IN SCHEMA requires superuser */ if (schemaidlist != NIL && !superuser()) ereport(ERROR, errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to create FOR ALL TABLES IN SCHEMA publication")); + errmsg("must be superuser to create FOR TABLES IN SCHEMA publication")); if (relations != NIL) { @@ -1979,7 +1979,7 @@ AlterPublicationOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to change owner of publication \"%s\"", NameStr(form->pubname)), - errhint("The owner of a FOR ALL TABLES IN SCHEMA publication must be a superuser."))); + errhint("The owner of a FOR TABLES IN SCHEMA publication must be a superuser."))); } form->pubowner = newOwnerId; diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index d76c0af394..0d8d292850 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10340,7 +10340,7 @@ AlterOwnerStmt: ALTER AGGREGATE aggregate_with_argtypes OWNER TO RoleSpec * pub_obj is one of: * * TABLE table [, ...] - * ALL TABLES IN SCHEMA schema [, ...] + * TABLES IN SCHEMA schema [, ...] * *****************************************************************************/ @@ -10375,7 +10375,7 @@ CreatePublicationStmt: ; /* - * FOR TABLE and FOR ALL TABLES IN SCHEMA specifications + * FOR TABLE and FOR TABLES IN SCHEMA specifications * * This rule parses publication objects with and without keyword prefixes. * @@ -10397,18 +10397,18 @@ PublicationObjSpec: $$->pubtable->columns = $3; $$->pubtable->whereClause = $4; } - | ALL TABLES IN_P SCHEMA ColId + | TABLES IN_P SCHEMA ColId { $$ = makeNode(PublicationObjSpec); $$->pubobjtype = PUBLICATIONOBJ_TABLES_IN_SCHEMA; - $$->name = $5; - $$->location = @5; + $$->name = $4; + $$->location = @4; } - | ALL TABLES IN_P SCHEMA CURRENT_SCHEMA + | TABLES IN_P SCHEMA CURRENT_SCHEMA { $$ = makeNode(PublicationObjSpec); $$->pubobjtype = PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA; - $$->location = @5; + $$->location = @4; } | ColId opt_column_list OptWhereClause { @@ -10484,7 +10484,7 @@ pub_obj_list: PublicationObjSpec * pub_obj is one of: * * TABLE table_name [, ...] - * ALL TABLES IN SCHEMA schema_name [, ...] + * TABLES IN SCHEMA schema_name [, ...] * *****************************************************************************/ @@ -18424,7 +18424,7 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner) ereport(ERROR, errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid publication object list"), - errdetail("One of TABLE or ALL TABLES IN SCHEMA must be specified before a standalone table or schema name."), + errdetail("One of TABLE or TABLES IN SCHEMA must be specified before a standalone table or schema name."), parser_errposition(pubobj->location)); foreach(cell, pubobjspec_list) diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 880580ed00..92bbffbe7c 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -1014,8 +1014,7 @@ pgoutput_column_list_init(PGOutputData *data, List *publications, * need to check all the given publication-table mappings and report an * error if any publications have a different column list. * - * FOR ALL TABLES and FOR ALL TABLES IN SCHEMA implies "don't use column - * list". + * FOR ALL TABLES and FOR TABLES IN SCHEMA imply "don't use column list". */ foreach(lc, publications) { diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 67b6d9079e..65a5c5ec4c 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -4317,7 +4317,7 @@ dumpPublicationNamespace(Archive *fout, const PublicationSchemaInfo *pubsinfo) query = createPQExpBuffer(); appendPQExpBuffer(query, "ALTER PUBLICATION %s ", fmtId(pubinfo->dobj.name)); - appendPQExpBuffer(query, "ADD ALL TABLES IN SCHEMA %s;\n", fmtId(schemainfo->dobj.name)); + appendPQExpBuffer(query, "ADD TABLES IN SCHEMA %s;\n", fmtId(schemainfo->dobj.name)); /* * There is no point in creating drop query as the drop is done by schema diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 2873b662fb..31410c2a55 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -2544,23 +2544,23 @@ my %tests = ( unlike => { exclude_dump_test_schema => 1, }, }, - 'ALTER PUBLICATION pub3 ADD ALL TABLES IN SCHEMA dump_test' => { + 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test' => { create_order => 51, create_sql => - 'ALTER PUBLICATION pub3 ADD ALL TABLES IN SCHEMA dump_test;', + 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test;', regexp => qr/^ - \QALTER PUBLICATION pub3 ADD ALL TABLES IN SCHEMA dump_test;\E + \QALTER PUBLICATION pub3 ADD TABLES IN SCHEMA dump_test;\E /xm, like => { %full_runs, section_post_data => 1, }, unlike => { exclude_dump_test_schema => 1, }, }, - 'ALTER PUBLICATION pub3 ADD ALL TABLES IN SCHEMA public' => { + 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public' => { create_order => 52, create_sql => - 'ALTER PUBLICATION pub3 ADD ALL TABLES IN SCHEMA public;', + 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;', regexp => qr/^ - \QALTER PUBLICATION pub3 ADD ALL TABLES IN SCHEMA public;\E + \QALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;\E /xm, like => { %full_runs, section_post_data => 1, }, }, diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index f3465adb85..cb75238d27 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -1820,7 +1820,7 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH("ADD", "DROP", "OWNER TO", "RENAME TO", "SET"); /* ALTER PUBLICATION <name> ADD */ else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD")) - COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE"); + COMPLETE_WITH("TABLES IN SCHEMA", "TABLE"); else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") || (HeadMatches("ALTER", "PUBLICATION", MatchAny, "ADD|SET", "TABLE") && ends_with(prev_wd, ','))) @@ -1844,10 +1844,10 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH(","); /* ALTER PUBLICATION <name> DROP */ else if (Matches("ALTER", "PUBLICATION", MatchAny, "DROP")) - COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE"); + COMPLETE_WITH("TABLES IN SCHEMA", "TABLE"); /* ALTER PUBLICATION <name> SET */ else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET")) - COMPLETE_WITH("(", "ALL TABLES IN SCHEMA", "TABLE"); + COMPLETE_WITH("(", "TABLES IN SCHEMA", "TABLE"); else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP|SET", "ALL", "TABLES", "IN", "SCHEMA")) COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas " AND nspname NOT LIKE E'pg\\\\_%%'", @@ -2990,9 +2990,9 @@ psql_completion(const char *text, int start, int end) /* CREATE PUBLICATION */ else if (Matches("CREATE", "PUBLICATION", MatchAny)) - COMPLETE_WITH("FOR TABLE", "FOR ALL TABLES", "FOR ALL TABLES IN SCHEMA", "WITH ("); + COMPLETE_WITH("FOR TABLE", "FOR ALL TABLES", "FOR TABLES IN SCHEMA", "WITH ("); else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR")) - COMPLETE_WITH("TABLE", "ALL TABLES", "ALL TABLES IN SCHEMA"); + COMPLETE_WITH("TABLE", "ALL TABLES", "TABLES IN SCHEMA"); else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL")) COMPLETE_WITH("TABLES", "TABLES IN SCHEMA"); else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES")) @@ -3015,7 +3015,7 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH(" WITH ("); /* - * Complete "CREATE PUBLICATION <name> FOR ALL TABLES IN SCHEMA <schema>, + * Complete "CREATE PUBLICATION <name> FOR TABLES IN SCHEMA <schema>, * ..." */ else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA")) @@ -3836,7 +3836,7 @@ psql_completion(const char *text, int start, int end) "ALL PROCEDURES IN SCHEMA", "ALL ROUTINES IN SCHEMA", "ALL SEQUENCES IN SCHEMA", - "ALL TABLES IN SCHEMA", + "TABLES IN SCHEMA", "DATABASE", "DOMAIN", "FOREIGN DATA WRAPPER", diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index d63f4f1cba..656dac6801 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -4593,7 +4593,7 @@ create schema alter1; create schema alter2; create table alter1.t1 (a int); set client_min_messages = 'ERROR'; -create publication pub1 for table alter1.t1, all tables in schema alter2; +create publication pub1 for table alter1.t1, tables in schema alter2; reset client_min_messages; alter table alter1.t1 set schema alter2; -- should fail ERROR: cannot move table "t1" to schema "alter2" diff --git a/src/test/regress/expected/object_address.out b/src/test/regress/expected/object_address.out index 4117fc27c9..a453750658 100644 --- a/src/test/regress/expected/object_address.out +++ b/src/test/regress/expected/object_address.out @@ -45,7 +45,7 @@ CREATE TRANSFORM FOR int LANGUAGE SQL ( -- suppress warning that depends on wal_level SET client_min_messages = 'ERROR'; CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable; -CREATE PUBLICATION addr_pub_schema FOR ALL TABLES IN SCHEMA addr_nsp; +CREATE PUBLICATION addr_pub_schema FOR TABLES IN SCHEMA addr_nsp; RESET client_min_messages; CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE); WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index e6e082de2f..ce63511b94 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -70,22 +70,22 @@ ALTER PUBLICATION testpub_foralltables SET TABLE pub_test.testpub_nopk; ERROR: publication "testpub_foralltables" is defined as FOR ALL TABLES DETAIL: Tables cannot be added to or dropped from FOR ALL TABLES publications. -- fail - can't add schema to 'FOR ALL TABLES' publication -ALTER PUBLICATION testpub_foralltables ADD ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_foralltables ADD TABLES IN SCHEMA pub_test; ERROR: publication "testpub_foralltables" is defined as FOR ALL TABLES DETAIL: Tables from schema cannot be added to, dropped from, or set on FOR ALL TABLES publications. -- fail - can't drop schema from 'FOR ALL TABLES' publication -ALTER PUBLICATION testpub_foralltables DROP ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_foralltables DROP TABLES IN SCHEMA pub_test; ERROR: publication "testpub_foralltables" is defined as FOR ALL TABLES DETAIL: Tables from schema cannot be added to, dropped from, or set on FOR ALL TABLES publications. -- fail - can't set schema to 'FOR ALL TABLES' publication -ALTER PUBLICATION testpub_foralltables SET ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_foralltables SET TABLES IN SCHEMA pub_test; ERROR: publication "testpub_foralltables" is defined as FOR ALL TABLES DETAIL: Tables from schema cannot be added to, dropped from, or set on FOR ALL TABLES publications. SET client_min_messages = 'ERROR'; CREATE PUBLICATION testpub_fortable FOR TABLE testpub_tbl1; RESET client_min_messages; -- should be able to add schema to 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable ADD ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_fortable ADD TABLES IN SCHEMA pub_test; \dRp+ testpub_fortable Publication testpub_fortable Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -97,7 +97,7 @@ Tables from schemas: "pub_test" -- should be able to drop schema from 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable DROP ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_fortable DROP TABLES IN SCHEMA pub_test; \dRp+ testpub_fortable Publication testpub_fortable Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -107,7 +107,7 @@ Tables: "public.testpub_tbl1" -- should be able to set schema to 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable SET ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_fortable SET TABLES IN SCHEMA pub_test; \dRp+ testpub_fortable Publication testpub_fortable Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -117,10 +117,10 @@ Tables from schemas: "pub_test" SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA pub_test; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA pub_test; RESET client_min_messages; -- fail - can't create publication with schema and table of the same schema -CREATE PUBLICATION testpub_for_tbl_schema FOR ALL TABLES IN SCHEMA pub_test, TABLE pub_test.testpub_nopk; +CREATE PUBLICATION testpub_for_tbl_schema FOR TABLES IN SCHEMA pub_test, TABLE pub_test.testpub_nopk; ERROR: cannot add relation "pub_test.testpub_nopk" to publication DETAIL: Table's schema "pub_test" is already part of the publication or part of the specified schema list. -- fail - can't add a table of the same schema to the schema publication @@ -363,13 +363,13 @@ Tables: DROP PUBLICATION testpub_syntax2; -- fail - schemas don't allow WHERE clause SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub_syntax3 FOR ALL TABLES IN SCHEMA testpub_rf_schema1 WHERE (a = 123); +CREATE PUBLICATION testpub_syntax3 FOR TABLES IN SCHEMA testpub_rf_schema1 WHERE (a = 123); ERROR: syntax error at or near "WHERE" -LINE 1: ...ntax3 FOR ALL TABLES IN SCHEMA testpub_rf_schema1 WHERE (a =... +LINE 1: ...b_syntax3 FOR TABLES IN SCHEMA testpub_rf_schema1 WHERE (a =... ^ -CREATE PUBLICATION testpub_syntax3 FOR ALL TABLES IN SCHEMA testpub_rf_schema1, testpub_rf_schema1 WHERE (a = 123); +CREATE PUBLICATION testpub_syntax3 FOR TABLES IN SCHEMA testpub_rf_schema1, testpub_rf_schema1 WHERE (a = 123); ERROR: WHERE clause not allowed for schema -LINE 1: ...tax3 FOR ALL TABLES IN SCHEMA testpub_rf_schema1, testpub_rf... +LINE 1: ..._syntax3 FOR TABLES IN SCHEMA testpub_rf_schema1, testpub_rf... ^ RESET client_min_messages; -- fail - duplicate tables are not allowed if that table has any WHERE clause @@ -465,8 +465,8 @@ ALTER PUBLICATION testpub5 DROP TABLE testpub_rf_tbl1 WHERE (e < 27); ERROR: cannot use a WHERE clause when removing a table from a publication -- fail - cannot ALTER SET table which is a member of a pre-existing schema SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub6 FOR ALL TABLES IN SCHEMA testpub_rf_schema2; -ALTER PUBLICATION testpub6 SET ALL TABLES IN SCHEMA testpub_rf_schema2, TABLE testpub_rf_schema2.testpub_rf_tbl6 WHERE (i < 99); +CREATE PUBLICATION testpub6 FOR TABLES IN SCHEMA testpub_rf_schema2; +ALTER PUBLICATION testpub6 SET TABLES IN SCHEMA testpub_rf_schema2, TABLE testpub_rf_schema2.testpub_rf_tbl6 WHERE (i < 99); ERROR: cannot add relation "testpub_rf_schema2.testpub_rf_tbl6" to publication DETAIL: Table's schema "testpub_rf_schema2" is already part of the publication or part of the specified schema list. RESET client_min_messages; @@ -1119,13 +1119,13 @@ GRANT CREATE ON DATABASE regression TO regress_publication_user2; SET ROLE regress_publication_user2; SET client_min_messages = 'ERROR'; CREATE PUBLICATION testpub2; -- ok -CREATE PUBLICATION testpub3 FOR ALL TABLES IN SCHEMA pub_test; -- fail -ERROR: must be superuser to create FOR ALL TABLES IN SCHEMA publication +CREATE PUBLICATION testpub3 FOR TABLES IN SCHEMA pub_test; -- fail +ERROR: must be superuser to create FOR TABLES IN SCHEMA publication CREATE PUBLICATION testpub3; -- ok RESET client_min_messages; ALTER PUBLICATION testpub2 ADD TABLE testpub_tbl1; -- fail ERROR: must be owner of table testpub_tbl1 -ALTER PUBLICATION testpub3 ADD ALL TABLES IN SCHEMA pub_test; -- fail +ALTER PUBLICATION testpub3 ADD TABLES IN SCHEMA pub_test; -- fail ERROR: must be superuser to add or set schemas SET ROLE regress_publication_user; GRANT regress_publication_user TO regress_publication_user2; @@ -1137,14 +1137,14 @@ SET ROLE regress_publication_user; CREATE ROLE regress_publication_user3; GRANT regress_publication_user2 TO regress_publication_user3; SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub4 FOR ALL TABLES IN SCHEMA pub_test; +CREATE PUBLICATION testpub4 FOR TABLES IN SCHEMA pub_test; RESET client_min_messages; ALTER PUBLICATION testpub4 OWNER TO regress_publication_user3; SET ROLE regress_publication_user3; -- fail - new owner must be superuser ALTER PUBLICATION testpub4 owner to regress_publication_user2; -- fail ERROR: permission denied to change owner of publication "testpub4" -HINT: The owner of a FOR ALL TABLES IN SCHEMA publication must be a superuser. +HINT: The owner of a FOR TABLES IN SCHEMA publication must be a superuser. ALTER PUBLICATION testpub4 owner to regress_publication_user; -- ok SET ROLE regress_publication_user; DROP PUBLICATION testpub4; @@ -1193,7 +1193,7 @@ CREATE TABLE pub_test2.tbl1 (id serial primary key, data text); CREATE TABLE "CURRENT_SCHEMA"."CURRENT_SCHEMA"(id int); -- suppress warning that depends on wal_level SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub1_forschema FOR ALL TABLES IN SCHEMA pub_test1; +CREATE PUBLICATION testpub1_forschema FOR TABLES IN SCHEMA pub_test1; \dRp+ testpub1_forschema Publication testpub1_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1202,7 +1202,7 @@ CREATE PUBLICATION testpub1_forschema FOR ALL TABLES IN SCHEMA pub_test1; Tables from schemas: "pub_test1" -CREATE PUBLICATION testpub2_forschema FOR ALL TABLES IN SCHEMA pub_test1, pub_test2, pub_test3; +CREATE PUBLICATION testpub2_forschema FOR TABLES IN SCHEMA pub_test1, pub_test2, pub_test3; \dRp+ testpub2_forschema Publication testpub2_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1214,10 +1214,10 @@ Tables from schemas: "pub_test3" -- check create publication on CURRENT_SCHEMA -CREATE PUBLICATION testpub3_forschema FOR ALL TABLES IN SCHEMA CURRENT_SCHEMA; -CREATE PUBLICATION testpub4_forschema FOR ALL TABLES IN SCHEMA "CURRENT_SCHEMA"; -CREATE PUBLICATION testpub5_forschema FOR ALL TABLES IN SCHEMA CURRENT_SCHEMA, "CURRENT_SCHEMA"; -CREATE PUBLICATION testpub6_forschema FOR ALL TABLES IN SCHEMA "CURRENT_SCHEMA", CURRENT_SCHEMA; +CREATE PUBLICATION testpub3_forschema FOR TABLES IN SCHEMA CURRENT_SCHEMA; +CREATE PUBLICATION testpub4_forschema FOR TABLES IN SCHEMA "CURRENT_SCHEMA"; +CREATE PUBLICATION testpub5_forschema FOR TABLES IN SCHEMA CURRENT_SCHEMA, "CURRENT_SCHEMA"; +CREATE PUBLICATION testpub6_forschema FOR TABLES IN SCHEMA "CURRENT_SCHEMA", CURRENT_SCHEMA; CREATE PUBLICATION testpub_fortable FOR TABLE "CURRENT_SCHEMA"."CURRENT_SCHEMA"; RESET client_min_messages; \dRp+ testpub3_forschema @@ -1264,30 +1264,30 @@ Tables: -- check create publication on CURRENT_SCHEMA where search_path is not set SET SEARCH_PATH=''; -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA CURRENT_SCHEMA; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA CURRENT_SCHEMA; ERROR: no schema has been selected for CURRENT_SCHEMA RESET SEARCH_PATH; --- check create publication on CURRENT_SCHEMA where TABLE/ALL TABLES in SCHEMA +-- check create publication on CURRENT_SCHEMA where TABLE/TABLES in SCHEMA -- is not specified CREATE PUBLICATION testpub_forschema1 FOR CURRENT_SCHEMA; ERROR: invalid publication object list LINE 1: CREATE PUBLICATION testpub_forschema1 FOR CURRENT_SCHEMA; ^ -DETAIL: One of TABLE or ALL TABLES IN SCHEMA must be specified before a standalone table or schema name. +DETAIL: One of TABLE or TABLES IN SCHEMA must be specified before a standalone table or schema name. -- check create publication on CURRENT_SCHEMA along with FOR TABLE CREATE PUBLICATION testpub_forschema1 FOR TABLE CURRENT_SCHEMA; ERROR: syntax error at or near "CURRENT_SCHEMA" LINE 1: CREATE PUBLICATION testpub_forschema1 FOR TABLE CURRENT_SCHE... ^ -- check create publication on a schema that does not exist -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA non_existent_schema; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA non_existent_schema; ERROR: schema "non_existent_schema" does not exist -- check create publication on a system schema -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA pg_catalog; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA pg_catalog; ERROR: cannot add schema "pg_catalog" to publication DETAIL: This operation is not supported for system schemas. -- check create publication on an object which is not schema -CREATE PUBLICATION testpub1_forschema1 FOR ALL TABLES IN SCHEMA testpub_view; +CREATE PUBLICATION testpub1_forschema1 FOR TABLES IN SCHEMA testpub_view; ERROR: schema "testpub_view" does not exist -- dropping the schema should reflect the change in publication DROP SCHEMA pub_test3; @@ -1322,7 +1322,7 @@ Tables from schemas: "pub_test2" -- alter publication add schema -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA pub_test2; +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA pub_test2; \dRp+ testpub1_forschema Publication testpub1_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1333,7 +1333,7 @@ Tables from schemas: "pub_test2" -- add non existent schema -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA non_existent_schema; +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA non_existent_schema; ERROR: schema "non_existent_schema" does not exist \dRp+ testpub1_forschema Publication testpub1_forschema @@ -1345,7 +1345,7 @@ Tables from schemas: "pub_test2" -- add a schema which is already added to the publication -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA pub_test1; ERROR: schema "pub_test1" is already member of publication "testpub1_forschema" \dRp+ testpub1_forschema Publication testpub1_forschema @@ -1357,7 +1357,7 @@ Tables from schemas: "pub_test2" -- alter publication drop schema -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test2; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test2; \dRp+ testpub1_forschema Publication testpub1_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1367,7 +1367,7 @@ Tables from schemas: "pub_test1" -- drop schema that is not present in the publication -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test2; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test2; ERROR: tables from schema "pub_test2" are not part of the publication \dRp+ testpub1_forschema Publication testpub1_forschema @@ -1378,7 +1378,7 @@ Tables from schemas: "pub_test1" -- drop a schema that does not exist in the system -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA non_existent_schema; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA non_existent_schema; ERROR: schema "non_existent_schema" does not exist \dRp+ testpub1_forschema Publication testpub1_forschema @@ -1389,7 +1389,7 @@ Tables from schemas: "pub_test1" -- drop all schemas -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test1; \dRp+ testpub1_forschema Publication testpub1_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1398,7 +1398,7 @@ ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test1; (1 row) -- alter publication set multiple schema -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA pub_test1, pub_test2; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA pub_test1, pub_test2; \dRp+ testpub1_forschema Publication testpub1_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1409,7 +1409,7 @@ Tables from schemas: "pub_test2" -- alter publication set non-existent schema -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA non_existent_schema; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA non_existent_schema; ERROR: schema "non_existent_schema" does not exist \dRp+ testpub1_forschema Publication testpub1_forschema @@ -1422,7 +1422,7 @@ Tables from schemas: -- alter publication set it duplicate schemas should set the schemas after -- removing the duplicate schemas -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA pub_test1, pub_test1; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA pub_test1, pub_test1; \dRp+ testpub1_forschema Publication testpub1_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1432,16 +1432,16 @@ Tables from schemas: "pub_test1" -- Verify that it fails to add a schema with a column specification -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA foo (a, b); +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA foo (a, b); ERROR: syntax error at or near "(" -LINE 1: ...TION testpub1_forschema ADD ALL TABLES IN SCHEMA foo (a, b); +LINE 1: ...LICATION testpub1_forschema ADD TABLES IN SCHEMA foo (a, b); ^ -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA foo, bar (a, b); +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA foo, bar (a, b); ERROR: column specification not allowed for schema -LINE 1: ... testpub1_forschema ADD ALL TABLES IN SCHEMA foo, bar (a, b)... +LINE 1: ...TION testpub1_forschema ADD TABLES IN SCHEMA foo, bar (a, b)... ^ -- cleanup pub_test1 schema for invalidation tests -ALTER PUBLICATION testpub2_forschema DROP ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub2_forschema DROP TABLES IN SCHEMA pub_test1; DROP PUBLICATION testpub3_forschema, testpub4_forschema, testpub5_forschema, testpub6_forschema, testpub_fortable; DROP SCHEMA "CURRENT_SCHEMA" CASCADE; NOTICE: drop cascades to table "CURRENT_SCHEMA"."CURRENT_SCHEMA" @@ -1455,10 +1455,10 @@ INSERT INTO pub_test1.tbl VALUES(1, 'test'); UPDATE pub_test1.tbl SET id = 2; ERROR: cannot update table "tbl" because it does not have a replica identity and publishes updates HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE. -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test1; -- success UPDATE pub_test1.tbl SET id = 2; -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA pub_test1; -- fail UPDATE pub_test1.tbl SET id = 2; ERROR: cannot update table "tbl" because it does not have a replica identity and publishes updates @@ -1472,7 +1472,7 @@ CREATE TABLE pub_testpart2.child_parent1 partition of pub_testpart1.parent1 for INSERT INTO pub_testpart2.child_parent1 values(1); UPDATE pub_testpart2.child_parent1 set a = 1; SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpubpart_forschema FOR ALL TABLES IN SCHEMA pub_testpart1; +CREATE PUBLICATION testpubpart_forschema FOR TABLES IN SCHEMA pub_testpart1; RESET client_min_messages; -- fail UPDATE pub_testpart1.parent1 set a = 1; @@ -1489,7 +1489,7 @@ CREATE TABLE pub_testpart1.child_parent2 partition of pub_testpart2.parent2 for INSERT INTO pub_testpart1.child_parent2 values(1); UPDATE pub_testpart1.child_parent2 set a = 1; SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpubpart_forschema FOR ALL TABLES IN SCHEMA pub_testpart2; +CREATE PUBLICATION testpubpart_forschema FOR TABLES IN SCHEMA pub_testpart2; RESET client_min_messages; -- fail UPDATE pub_testpart2.child_parent1 set a = 1; @@ -1501,7 +1501,7 @@ HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE. UPDATE pub_testpart1.child_parent2 set a = 1; ERROR: cannot update table "child_parent2" because it does not have a replica identity and publishes updates HINT: To enable updating the table, set REPLICA IDENTITY using ALTER TABLE. --- alter publication set 'ALL TABLES IN SCHEMA' on an empty publication. +-- alter publication set 'TABLES IN SCHEMA' on an empty publication. SET client_min_messages = 'ERROR'; CREATE PUBLICATION testpub3_forschema; RESET client_min_messages; @@ -1512,7 +1512,7 @@ RESET client_min_messages; regress_publication_user | f | t | t | t | t | f (1 row) -ALTER PUBLICATION testpub3_forschema SET ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub3_forschema SET TABLES IN SCHEMA pub_test1; \dRp+ testpub3_forschema Publication testpub3_forschema Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root @@ -1521,10 +1521,10 @@ ALTER PUBLICATION testpub3_forschema SET ALL TABLES IN SCHEMA pub_test1; Tables from schemas: "pub_test1" --- create publication including both 'FOR TABLE' and 'FOR ALL TABLES IN SCHEMA' +-- create publication including both 'FOR TABLE' and 'FOR TABLES IN SCHEMA' SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub_forschema_fortable FOR ALL TABLES IN SCHEMA pub_test1, TABLE pub_test2.tbl1; -CREATE PUBLICATION testpub_fortable_forschema FOR TABLE pub_test2.tbl1, ALL TABLES IN SCHEMA pub_test1; +CREATE PUBLICATION testpub_forschema_fortable FOR TABLES IN SCHEMA pub_test1, TABLE pub_test2.tbl1; +CREATE PUBLICATION testpub_fortable_forschema FOR TABLE pub_test2.tbl1, TABLES IN SCHEMA pub_test1; RESET client_min_messages; \dRp+ testpub_forschema_fortable Publication testpub_forschema_fortable @@ -1546,13 +1546,13 @@ Tables: Tables from schemas: "pub_test1" --- fail specifying table without any of 'FOR ALL TABLES IN SCHEMA' or +-- fail specifying table without any of 'FOR TABLES IN SCHEMA' or --'FOR TABLE' or 'FOR ALL TABLES' CREATE PUBLICATION testpub_error FOR pub_test2.tbl1; ERROR: invalid publication object list LINE 1: CREATE PUBLICATION testpub_error FOR pub_test2.tbl1; ^ -DETAIL: One of TABLE or ALL TABLES IN SCHEMA must be specified before a standalone table or schema name. +DETAIL: One of TABLE or TABLES IN SCHEMA must be specified before a standalone table or schema name. DROP VIEW testpub_view; DROP PUBLICATION testpub_default; DROP PUBLICATION testpib_ins_trunct; @@ -1585,7 +1585,7 @@ CREATE SCHEMA sch2; CREATE TABLE sch1.tbl1 (a int) PARTITION BY RANGE(a); CREATE TABLE sch2.tbl1_part1 PARTITION OF sch1.tbl1 FOR VALUES FROM (1) to (10); -- Schema publication that does not include the schema that has the parent table -CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=1); +CREATE PUBLICATION pub FOR TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=1); SELECT * FROM pg_publication_tables; pubname | schemaname | tablename | attnames | rowfilter ---------+------------+------------+----------+----------- @@ -1611,7 +1611,7 @@ SELECT * FROM pg_publication_tables; DROP PUBLICATION pub; -- Schema publication that does not include the schema that has the parent table -CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=0); +CREATE PUBLICATION pub FOR TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=0); SELECT * FROM pg_publication_tables; pubname | schemaname | tablename | attnames | rowfilter ---------+------------+------------+----------+----------- @@ -1643,7 +1643,7 @@ CREATE TABLE sch1.tbl1_part1 PARTITION OF sch1.tbl1 FOR VALUES FROM (1) to (10); CREATE TABLE sch1.tbl1_part2 PARTITION OF sch1.tbl1 FOR VALUES FROM (10) to (20); CREATE TABLE sch1.tbl1_part3 (a int) PARTITION BY RANGE(a); ALTER TABLE sch1.tbl1 ATTACH PARTITION sch1.tbl1_part3 FOR VALUES FROM (20) to (30); -CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA sch1 WITH (PUBLISH_VIA_PARTITION_ROOT=1); +CREATE PUBLICATION pub FOR TABLES IN SCHEMA sch1 WITH (PUBLISH_VIA_PARTITION_ROOT=1); SELECT * FROM pg_publication_tables; pubname | schemaname | tablename | attnames | rowfilter ---------+------------+-----------+----------+----------- diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index e7013f5e15..8846c14dbb 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -3029,7 +3029,7 @@ create schema alter1; create schema alter2; create table alter1.t1 (a int); set client_min_messages = 'ERROR'; -create publication pub1 for table alter1.t1, all tables in schema alter2; +create publication pub1 for table alter1.t1, tables in schema alter2; reset client_min_messages; alter table alter1.t1 set schema alter2; -- should fail drop publication pub1; diff --git a/src/test/regress/sql/object_address.sql b/src/test/regress/sql/object_address.sql index acd0468a9d..3324cb6dff 100644 --- a/src/test/regress/sql/object_address.sql +++ b/src/test/regress/sql/object_address.sql @@ -48,7 +48,7 @@ CREATE TRANSFORM FOR int LANGUAGE SQL ( -- suppress warning that depends on wal_level SET client_min_messages = 'ERROR'; CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable; -CREATE PUBLICATION addr_pub_schema FOR ALL TABLES IN SCHEMA addr_nsp; +CREATE PUBLICATION addr_pub_schema FOR TABLES IN SCHEMA addr_nsp; RESET client_min_messages; CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE); CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable; diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql index a56387edee..231c9d5c53 100644 --- a/src/test/regress/sql/publication.sql +++ b/src/test/regress/sql/publication.sql @@ -52,30 +52,30 @@ ALTER PUBLICATION testpub_foralltables DROP TABLE testpub_tbl2; ALTER PUBLICATION testpub_foralltables SET TABLE pub_test.testpub_nopk; -- fail - can't add schema to 'FOR ALL TABLES' publication -ALTER PUBLICATION testpub_foralltables ADD ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_foralltables ADD TABLES IN SCHEMA pub_test; -- fail - can't drop schema from 'FOR ALL TABLES' publication -ALTER PUBLICATION testpub_foralltables DROP ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_foralltables DROP TABLES IN SCHEMA pub_test; -- fail - can't set schema to 'FOR ALL TABLES' publication -ALTER PUBLICATION testpub_foralltables SET ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_foralltables SET TABLES IN SCHEMA pub_test; SET client_min_messages = 'ERROR'; CREATE PUBLICATION testpub_fortable FOR TABLE testpub_tbl1; RESET client_min_messages; -- should be able to add schema to 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable ADD ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_fortable ADD TABLES IN SCHEMA pub_test; \dRp+ testpub_fortable -- should be able to drop schema from 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable DROP ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_fortable DROP TABLES IN SCHEMA pub_test; \dRp+ testpub_fortable -- should be able to set schema to 'FOR TABLE' publication -ALTER PUBLICATION testpub_fortable SET ALL TABLES IN SCHEMA pub_test; +ALTER PUBLICATION testpub_fortable SET TABLES IN SCHEMA pub_test; \dRp+ testpub_fortable SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA pub_test; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA pub_test; RESET client_min_messages; -- fail - can't create publication with schema and table of the same schema -CREATE PUBLICATION testpub_for_tbl_schema FOR ALL TABLES IN SCHEMA pub_test, TABLE pub_test.testpub_nopk; +CREATE PUBLICATION testpub_for_tbl_schema FOR TABLES IN SCHEMA pub_test, TABLE pub_test.testpub_nopk; -- fail - can't add a table of the same schema to the schema publication ALTER PUBLICATION testpub_forschema ADD TABLE pub_test.testpub_nopk; -- fail - can't drop a table from the schema publication which isn't in the @@ -182,8 +182,8 @@ RESET client_min_messages; DROP PUBLICATION testpub_syntax2; -- fail - schemas don't allow WHERE clause SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub_syntax3 FOR ALL TABLES IN SCHEMA testpub_rf_schema1 WHERE (a = 123); -CREATE PUBLICATION testpub_syntax3 FOR ALL TABLES IN SCHEMA testpub_rf_schema1, testpub_rf_schema1 WHERE (a = 123); +CREATE PUBLICATION testpub_syntax3 FOR TABLES IN SCHEMA testpub_rf_schema1 WHERE (a = 123); +CREATE PUBLICATION testpub_syntax3 FOR TABLES IN SCHEMA testpub_rf_schema1, testpub_rf_schema1 WHERE (a = 123); RESET client_min_messages; -- fail - duplicate tables are not allowed if that table has any WHERE clause SET client_min_messages = 'ERROR'; @@ -241,8 +241,8 @@ ALTER PUBLICATION testpub5 SET TABLE testpub_rf_tbl1 WHERE (ROW(a, 2) IS NULL); ALTER PUBLICATION testpub5 DROP TABLE testpub_rf_tbl1 WHERE (e < 27); -- fail - cannot ALTER SET table which is a member of a pre-existing schema SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub6 FOR ALL TABLES IN SCHEMA testpub_rf_schema2; -ALTER PUBLICATION testpub6 SET ALL TABLES IN SCHEMA testpub_rf_schema2, TABLE testpub_rf_schema2.testpub_rf_tbl6 WHERE (i < 99); +CREATE PUBLICATION testpub6 FOR TABLES IN SCHEMA testpub_rf_schema2; +ALTER PUBLICATION testpub6 SET TABLES IN SCHEMA testpub_rf_schema2, TABLE testpub_rf_schema2.testpub_rf_tbl6 WHERE (i < 99); RESET client_min_messages; DROP TABLE testpub_rf_tbl1; @@ -747,12 +747,12 @@ GRANT CREATE ON DATABASE regression TO regress_publication_user2; SET ROLE regress_publication_user2; SET client_min_messages = 'ERROR'; CREATE PUBLICATION testpub2; -- ok -CREATE PUBLICATION testpub3 FOR ALL TABLES IN SCHEMA pub_test; -- fail +CREATE PUBLICATION testpub3 FOR TABLES IN SCHEMA pub_test; -- fail CREATE PUBLICATION testpub3; -- ok RESET client_min_messages; ALTER PUBLICATION testpub2 ADD TABLE testpub_tbl1; -- fail -ALTER PUBLICATION testpub3 ADD ALL TABLES IN SCHEMA pub_test; -- fail +ALTER PUBLICATION testpub3 ADD TABLES IN SCHEMA pub_test; -- fail SET ROLE regress_publication_user; GRANT regress_publication_user TO regress_publication_user2; @@ -766,7 +766,7 @@ SET ROLE regress_publication_user; CREATE ROLE regress_publication_user3; GRANT regress_publication_user2 TO regress_publication_user3; SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub4 FOR ALL TABLES IN SCHEMA pub_test; +CREATE PUBLICATION testpub4 FOR TABLES IN SCHEMA pub_test; RESET client_min_messages; ALTER PUBLICATION testpub4 OWNER TO regress_publication_user3; SET ROLE regress_publication_user3; @@ -813,17 +813,17 @@ CREATE TABLE "CURRENT_SCHEMA"."CURRENT_SCHEMA"(id int); -- suppress warning that depends on wal_level SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub1_forschema FOR ALL TABLES IN SCHEMA pub_test1; +CREATE PUBLICATION testpub1_forschema FOR TABLES IN SCHEMA pub_test1; \dRp+ testpub1_forschema -CREATE PUBLICATION testpub2_forschema FOR ALL TABLES IN SCHEMA pub_test1, pub_test2, pub_test3; +CREATE PUBLICATION testpub2_forschema FOR TABLES IN SCHEMA pub_test1, pub_test2, pub_test3; \dRp+ testpub2_forschema -- check create publication on CURRENT_SCHEMA -CREATE PUBLICATION testpub3_forschema FOR ALL TABLES IN SCHEMA CURRENT_SCHEMA; -CREATE PUBLICATION testpub4_forschema FOR ALL TABLES IN SCHEMA "CURRENT_SCHEMA"; -CREATE PUBLICATION testpub5_forschema FOR ALL TABLES IN SCHEMA CURRENT_SCHEMA, "CURRENT_SCHEMA"; -CREATE PUBLICATION testpub6_forschema FOR ALL TABLES IN SCHEMA "CURRENT_SCHEMA", CURRENT_SCHEMA; +CREATE PUBLICATION testpub3_forschema FOR TABLES IN SCHEMA CURRENT_SCHEMA; +CREATE PUBLICATION testpub4_forschema FOR TABLES IN SCHEMA "CURRENT_SCHEMA"; +CREATE PUBLICATION testpub5_forschema FOR TABLES IN SCHEMA CURRENT_SCHEMA, "CURRENT_SCHEMA"; +CREATE PUBLICATION testpub6_forschema FOR TABLES IN SCHEMA "CURRENT_SCHEMA", CURRENT_SCHEMA; CREATE PUBLICATION testpub_fortable FOR TABLE "CURRENT_SCHEMA"."CURRENT_SCHEMA"; RESET client_min_messages; @@ -836,10 +836,10 @@ RESET client_min_messages; -- check create publication on CURRENT_SCHEMA where search_path is not set SET SEARCH_PATH=''; -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA CURRENT_SCHEMA; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA CURRENT_SCHEMA; RESET SEARCH_PATH; --- check create publication on CURRENT_SCHEMA where TABLE/ALL TABLES in SCHEMA +-- check create publication on CURRENT_SCHEMA where TABLE/TABLES in SCHEMA -- is not specified CREATE PUBLICATION testpub_forschema1 FOR CURRENT_SCHEMA; @@ -847,13 +847,13 @@ CREATE PUBLICATION testpub_forschema1 FOR CURRENT_SCHEMA; CREATE PUBLICATION testpub_forschema1 FOR TABLE CURRENT_SCHEMA; -- check create publication on a schema that does not exist -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA non_existent_schema; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA non_existent_schema; -- check create publication on a system schema -CREATE PUBLICATION testpub_forschema FOR ALL TABLES IN SCHEMA pg_catalog; +CREATE PUBLICATION testpub_forschema FOR TABLES IN SCHEMA pg_catalog; -- check create publication on an object which is not schema -CREATE PUBLICATION testpub1_forschema1 FOR ALL TABLES IN SCHEMA testpub_view; +CREATE PUBLICATION testpub1_forschema1 FOR TABLES IN SCHEMA testpub_view; -- dropping the schema should reflect the change in publication DROP SCHEMA pub_test3; @@ -867,52 +867,52 @@ ALTER SCHEMA pub_test1_renamed RENAME to pub_test1; \dRp+ testpub2_forschema -- alter publication add schema -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA pub_test2; +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA pub_test2; \dRp+ testpub1_forschema -- add non existent schema -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA non_existent_schema; +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA non_existent_schema; \dRp+ testpub1_forschema -- add a schema which is already added to the publication -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA pub_test1; \dRp+ testpub1_forschema -- alter publication drop schema -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test2; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test2; \dRp+ testpub1_forschema -- drop schema that is not present in the publication -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test2; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test2; \dRp+ testpub1_forschema -- drop a schema that does not exist in the system -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA non_existent_schema; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA non_existent_schema; \dRp+ testpub1_forschema -- drop all schemas -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test1; \dRp+ testpub1_forschema -- alter publication set multiple schema -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA pub_test1, pub_test2; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA pub_test1, pub_test2; \dRp+ testpub1_forschema -- alter publication set non-existent schema -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA non_existent_schema; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA non_existent_schema; \dRp+ testpub1_forschema -- alter publication set it duplicate schemas should set the schemas after -- removing the duplicate schemas -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA pub_test1, pub_test1; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA pub_test1, pub_test1; \dRp+ testpub1_forschema -- Verify that it fails to add a schema with a column specification -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA foo (a, b); -ALTER PUBLICATION testpub1_forschema ADD ALL TABLES IN SCHEMA foo, bar (a, b); +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA foo (a, b); +ALTER PUBLICATION testpub1_forschema ADD TABLES IN SCHEMA foo, bar (a, b); -- cleanup pub_test1 schema for invalidation tests -ALTER PUBLICATION testpub2_forschema DROP ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub2_forschema DROP TABLES IN SCHEMA pub_test1; DROP PUBLICATION testpub3_forschema, testpub4_forschema, testpub5_forschema, testpub6_forschema, testpub_fortable; DROP SCHEMA "CURRENT_SCHEMA" CASCADE; @@ -925,11 +925,11 @@ INSERT INTO pub_test1.tbl VALUES(1, 'test'); -- fail UPDATE pub_test1.tbl SET id = 2; -ALTER PUBLICATION testpub1_forschema DROP ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema DROP TABLES IN SCHEMA pub_test1; -- success UPDATE pub_test1.tbl SET id = 2; -ALTER PUBLICATION testpub1_forschema SET ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub1_forschema SET TABLES IN SCHEMA pub_test1; -- fail UPDATE pub_test1.tbl SET id = 2; @@ -944,7 +944,7 @@ CREATE TABLE pub_testpart2.child_parent1 partition of pub_testpart1.parent1 for INSERT INTO pub_testpart2.child_parent1 values(1); UPDATE pub_testpart2.child_parent1 set a = 1; SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpubpart_forschema FOR ALL TABLES IN SCHEMA pub_testpart1; +CREATE PUBLICATION testpubpart_forschema FOR TABLES IN SCHEMA pub_testpart1; RESET client_min_messages; -- fail @@ -960,7 +960,7 @@ CREATE TABLE pub_testpart1.child_parent2 partition of pub_testpart2.parent2 for INSERT INTO pub_testpart1.child_parent2 values(1); UPDATE pub_testpart1.child_parent2 set a = 1; SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpubpart_forschema FOR ALL TABLES IN SCHEMA pub_testpart2; +CREATE PUBLICATION testpubpart_forschema FOR TABLES IN SCHEMA pub_testpart2; RESET client_min_messages; -- fail @@ -968,24 +968,24 @@ UPDATE pub_testpart2.child_parent1 set a = 1; UPDATE pub_testpart2.parent2 set a = 1; UPDATE pub_testpart1.child_parent2 set a = 1; --- alter publication set 'ALL TABLES IN SCHEMA' on an empty publication. +-- alter publication set 'TABLES IN SCHEMA' on an empty publication. SET client_min_messages = 'ERROR'; CREATE PUBLICATION testpub3_forschema; RESET client_min_messages; \dRp+ testpub3_forschema -ALTER PUBLICATION testpub3_forschema SET ALL TABLES IN SCHEMA pub_test1; +ALTER PUBLICATION testpub3_forschema SET TABLES IN SCHEMA pub_test1; \dRp+ testpub3_forschema --- create publication including both 'FOR TABLE' and 'FOR ALL TABLES IN SCHEMA' +-- create publication including both 'FOR TABLE' and 'FOR TABLES IN SCHEMA' SET client_min_messages = 'ERROR'; -CREATE PUBLICATION testpub_forschema_fortable FOR ALL TABLES IN SCHEMA pub_test1, TABLE pub_test2.tbl1; -CREATE PUBLICATION testpub_fortable_forschema FOR TABLE pub_test2.tbl1, ALL TABLES IN SCHEMA pub_test1; +CREATE PUBLICATION testpub_forschema_fortable FOR TABLES IN SCHEMA pub_test1, TABLE pub_test2.tbl1; +CREATE PUBLICATION testpub_fortable_forschema FOR TABLE pub_test2.tbl1, TABLES IN SCHEMA pub_test1; RESET client_min_messages; \dRp+ testpub_forschema_fortable \dRp+ testpub_fortable_forschema --- fail specifying table without any of 'FOR ALL TABLES IN SCHEMA' or +-- fail specifying table without any of 'FOR TABLES IN SCHEMA' or --'FOR TABLE' or 'FOR ALL TABLES' CREATE PUBLICATION testpub_error FOR pub_test2.tbl1; @@ -1015,7 +1015,7 @@ CREATE SCHEMA sch2; CREATE TABLE sch1.tbl1 (a int) PARTITION BY RANGE(a); CREATE TABLE sch2.tbl1_part1 PARTITION OF sch1.tbl1 FOR VALUES FROM (1) to (10); -- Schema publication that does not include the schema that has the parent table -CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=1); +CREATE PUBLICATION pub FOR TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=1); SELECT * FROM pg_publication_tables; DROP PUBLICATION pub; @@ -1029,7 +1029,7 @@ SELECT * FROM pg_publication_tables; DROP PUBLICATION pub; -- Schema publication that does not include the schema that has the parent table -CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=0); +CREATE PUBLICATION pub FOR TABLES IN SCHEMA sch2 WITH (PUBLISH_VIA_PARTITION_ROOT=0); SELECT * FROM pg_publication_tables; DROP PUBLICATION pub; @@ -1050,7 +1050,7 @@ CREATE TABLE sch1.tbl1_part1 PARTITION OF sch1.tbl1 FOR VALUES FROM (1) to (10); CREATE TABLE sch1.tbl1_part2 PARTITION OF sch1.tbl1 FOR VALUES FROM (10) to (20); CREATE TABLE sch1.tbl1_part3 (a int) PARTITION BY RANGE(a); ALTER TABLE sch1.tbl1 ATTACH PARTITION sch1.tbl1_part3 FOR VALUES FROM (20) to (30); -CREATE PUBLICATION pub FOR ALL TABLES IN SCHEMA sch1 WITH (PUBLISH_VIA_PARTITION_ROOT=1); +CREATE PUBLICATION pub FOR TABLES IN SCHEMA sch1 WITH (PUBLISH_VIA_PARTITION_ROOT=1); SELECT * FROM pg_publication_tables; RESET client_min_messages; diff --git a/src/test/subscription/t/025_rep_changes_for_schema.pl b/src/test/subscription/t/025_rep_changes_for_schema.pl index 627c63b529..4cfdb8b8ad 100644 --- a/src/test/subscription/t/025_rep_changes_for_schema.pl +++ b/src/test/subscription/t/025_rep_changes_for_schema.pl @@ -18,7 +18,7 @@ my $node_subscriber = PostgreSQL::Test::Cluster->new('subscriber'); $node_subscriber->init(allows_streaming => 'logical'); $node_subscriber->start; -# Test replication with publications created using FOR ALL TABLES IN SCHEMA +# Test replication with publications created using FOR TABLES IN SCHEMA # option. # Create schemas and tables on publisher $node_publisher->safe_psql('postgres', "CREATE SCHEMA sch1"); @@ -56,7 +56,7 @@ $node_subscriber->safe_psql('postgres', # Setup logical replication my $publisher_connstr = $node_publisher->connstr . ' dbname=postgres'; $node_publisher->safe_psql('postgres', - "CREATE PUBLICATION tap_pub_schema FOR ALL TABLES IN SCHEMA sch1"); + "CREATE PUBLICATION tap_pub_schema FOR TABLES IN SCHEMA sch1"); $node_subscriber->safe_psql('postgres', "CREATE SUBSCRIPTION tap_sub_schema CONNECTION '$publisher_connstr' PUBLICATION tap_pub_schema" @@ -190,7 +190,7 @@ is($result, qq(3), $node_publisher->safe_psql( 'postgres', " INSERT INTO sch1.tab1 VALUES(21); - ALTER PUBLICATION tap_pub_schema DROP ALL TABLES IN SCHEMA sch1; + ALTER PUBLICATION tap_pub_schema DROP TABLES IN SCHEMA sch1; INSERT INTO sch1.tab1 values(22);" ); diff --git a/src/test/subscription/t/028_row_filter.pl b/src/test/subscription/t/028_row_filter.pl index f5f8a67092..ba07ed37b7 100644 --- a/src/test/subscription/t/028_row_filter.pl +++ b/src/test/subscription/t/028_row_filter.pl @@ -77,9 +77,9 @@ $node_subscriber->safe_psql('postgres', "DROP TABLE tab_rf_x"); # ==================================================================== # ==================================================================== -# Testcase start: ALL TABLES IN SCHEMA +# Testcase start: TABLES IN SCHEMA # -# The ALL TABLES IN SCHEMA test is independent of all other test cases so it +# The TABLES IN SCHEMA test is independent of all other test cases so it # cleans up after itself. # create tables pub and sub @@ -119,7 +119,7 @@ $node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub_x FOR TABLE schema_rf_x.tab_rf_x WHERE (x > 10)" ); $node_publisher->safe_psql('postgres', - "CREATE PUBLICATION tap_pub_allinschema FOR ALL TABLES IN SCHEMA schema_rf_x" + "CREATE PUBLICATION tap_pub_allinschema FOR TABLES IN SCHEMA schema_rf_x" ); $node_publisher->safe_psql('postgres', "ALTER PUBLICATION tap_pub_allinschema ADD TABLE public.tab_rf_partition WHERE (x > 10)" @@ -131,7 +131,7 @@ $node_subscriber->safe_psql('postgres', # wait for initial table synchronization to finish $node_subscriber->wait_for_subscription_sync($node_publisher, $appname); -# The subscription of the ALL TABLES IN SCHEMA publication means there should be +# The subscription of the TABLES IN SCHEMA publication means there should be # no filtering on the tablesync COPY, so expect all 5 will be present. $result = $node_subscriber->safe_psql('postgres', "SELECT count(x) FROM schema_rf_x.tab_rf_x"); @@ -139,7 +139,7 @@ is($result, qq(5), 'check initial data copy from table tab_rf_x should not be filtered'); # Similarly, the table filter for tab_rf_x (after the initial phase) has no -# effect when combined with the ALL TABLES IN SCHEMA. Meanwhile, the filter for +# effect when combined with the TABLES IN SCHEMA. Meanwhile, the filter for # the tab_rf_partition does work because that partition belongs to a different # schema (and publish_via_partition_root = false). # Expected: @@ -175,7 +175,7 @@ $node_subscriber->safe_psql('postgres', $node_subscriber->safe_psql('postgres', "DROP TABLE schema_rf_x.tab_rf_x"); $node_subscriber->safe_psql('postgres', "DROP SCHEMA schema_rf_x"); -# Testcase end: ALL TABLES IN SCHEMA +# Testcase end: TABLES IN SCHEMA # ==================================================================== # ====================================================== diff --git a/src/test/subscription/t/031_column_list.pl b/src/test/subscription/t/031_column_list.pl index b6644556cf..3e4bfc2178 100644 --- a/src/test/subscription/t/031_column_list.pl +++ b/src/test/subscription/t/031_column_list.pl @@ -913,7 +913,7 @@ $node_publisher->safe_psql( DROP TABLE test_mix_2; CREATE TABLE test_mix_3 (a int PRIMARY KEY, b int, c int); CREATE PUBLICATION pub_mix_5 FOR TABLE test_mix_3 (a, b, c); - CREATE PUBLICATION pub_mix_6 FOR ALL TABLES IN SCHEMA public; + CREATE PUBLICATION pub_mix_6 FOR TABLES IN SCHEMA public; -- initial data INSERT INTO test_mix_3 VALUES (1, 2, 3); @@ -1004,7 +1004,7 @@ $node_publisher->safe_psql( CREATE TABLE s1.t (a int, b int, c int) PARTITION BY RANGE (a); CREATE TABLE t_1 PARTITION OF s1.t FOR VALUES FROM (1) TO (10); - CREATE PUBLICATION pub1 FOR ALL TABLES IN SCHEMA s1; + CREATE PUBLICATION pub1 FOR TABLES IN SCHEMA s1; CREATE PUBLICATION pub2 FOR TABLE t_1(a, b, c); -- initial data -- 2.30.2