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.
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.
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 } [, ... ]
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.
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;
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;
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 } [, ... ]
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.
- FOR ALL TABLES IN SCHEMA
+ FOR TABLES IN SCHEMA
Marks the publication as one that replicates changes for all tables in
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.
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.
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;
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;
publications has no WHERE 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
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.
/*
* 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)
}
/*
- * 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 *
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)
{
(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;
* pub_obj is one of:
*
* TABLE table [, ...]
- * ALL TABLES IN SCHEMA schema [, ...]
+ * TABLES IN SCHEMA schema [, ...]
*
*****************************************************************************/
;
/*
- * 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.
*
$$->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
{
* pub_obj is one of:
*
* TABLE table_name [, ...]
- * ALL TABLES IN SCHEMA schema_name [, ...]
+ * TABLES IN SCHEMA schema_name [, ...]
*
*****************************************************************************/
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)
* 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)
{
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
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;',
- regexp => qr/^
- \QALTER PUBLICATION pub3 ADD ALL TABLES IN SCHEMA public;\E
+ create_sql => 'ALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;',
+ regexp => qr/^
+ \QALTER PUBLICATION pub3 ADD TABLES IN SCHEMA public;\E
/xm,
like => { %full_runs, section_post_data => 1, },
},
COMPLETE_WITH("ADD", "DROP", "OWNER TO", "RENAME TO", "SET");
/* ALTER PUBLICATION 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, ',')))
COMPLETE_WITH(",");
/* ALTER PUBLICATION DROP */
else if (Matches("ALTER", "PUBLICATION", MatchAny, "DROP"))
- COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE");
+ COMPLETE_WITH("TABLES IN SCHEMA", "TABLE");
/* ALTER PUBLICATION 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\\\\_%%'",
/* 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"))
COMPLETE_WITH(" WITH (");
/*
- * Complete "CREATE PUBLICATION FOR ALL TABLES IN SCHEMA ,
- * ..."
+ * Complete "CREATE PUBLICATION FOR TABLES IN SCHEMA , ..."
*/
else if (Matches("CREATE", "PUBLICATION", MatchAny, "FOR", "ALL", "TABLES", "IN", "SCHEMA"))
COMPLETE_WITH_QUERY_PLUS(Query_for_list_of_schemas
"ALL PROCEDURES IN SCHEMA",
"ALL ROUTINES IN SCHEMA",
"ALL SEQUENCES IN SCHEMA",
- "ALL TABLES IN SCHEMA",
+ "TABLES IN SCHEMA",
"DATABASE",
"DOMAIN",
"FOREIGN DATA WRAPPER",
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"
-- 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
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
"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
"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
"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
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
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;
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;
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;
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
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
"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
-- 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;
"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
"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
"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
"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
"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
"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
"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
(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
"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
-- 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
"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"
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
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;
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;
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;
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
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
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;
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
---------+------------+------------+----------+-----------
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
---------+------------+------------+----------+-----------
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
---------+------------+-----------+----------+-----------
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;
-- 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;
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
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';
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;
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;
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;
-- 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;
-- 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;
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;
\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;
-- 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;
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
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.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;
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;
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;
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;
$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");
# 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"
$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);"
);
# ====================================================================
# ====================================================================
-# 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
"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)"
# 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");
'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:
$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
# ====================================================================
# ======================================================
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);
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