Re: Added schema level support for publication.
Greg Nancarrow <gregn4422@gmail.com>
From: Greg Nancarrow <gregn4422@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>,
"houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
Tom Lane <tgl@sss.pgh.pa.us>, Peter Smith <smithpb2250@gmail.com>, Ajin Cherian <itsajin@gmail.com>, Rahila Syed <rahilasyed90@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: 2021-10-05T05:40:34Z
Lists: pgsql-hackers
On Tue, Oct 5, 2021 at 3:11 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > Code has been added to prevent a table being set (via ALTER TABLE) to > > UNLOGGED if it is part of a publication, but I found that I could > > still add all tables of a schema having a table that is UNLOGGED: > > > > postgres=# create schema sch; > > CREATE SCHEMA > > postgres=# create unlogged table sch.test(i int); > > CREATE TABLE > > postgres=# create publication pub for table sch.test; > > ERROR: cannot add relation "test" to publication > > DETAIL: Temporary and unlogged relations cannot be replicated. > > postgres=# create publication pub for all tables in schema sch; > > CREATE PUBLICATION > > > > What about when you use "create publication pub for all tables;"? I > think that also works, now on similar lines shouldn't the behavior of > "all tables in schema" publication be the same? I mean if we want we > can detect and give an error but is it advisable to give an error if > there are just one or few tables in schema that are unlogged? > OK, it seems that for the ALL TABLES case, there is no such error check, and it just silently skips replication of any temporary/unlogged tables. This is intentional, right? I couldn't see any documentation specifically related to this, so I think perhaps it should be updated to describe this behaviour. At the moment, the existing documentation just states FOR TABLE that "Temporary tables, unlogged tables, foreign tables, materialized views, and regular views cannot be part of a publication". Yes, I agree that ALL TABLES IN SCHEMA should behave the same as the ALL TABLES case. Problem is, shouldn't setting UNLOGGED on a table only then be disallowed if that table was publicised using FOR TABLE? With the patch applied: postgres=# create publication pub3 for all tables in schema sch; CREATE PUBLICATION postgres=# create table sch.test3(i int); CREATE TABLE postgres=# alter table sch.test3 set unlogged; ERROR: cannot change table "test3" to unlogged because it is part of a publication DETAIL: Unlogged relations cannot be replicated. Regards, Greg Nancarrow Fujitsu Australia
Commits
-
Include schema/table publications even with exclude options in dump.
- 4aa6fa3cd0a2 18.0 landed
-
Rename some enums to use TABLE instead of REL.
- b3812d0b9bcf 15.0 landed
-
Add tap tests for the schema publications.
- 6b0f6f79eef2 15.0 landed
-
Allow publishing the tables of schema.
- 5a2832465fd8 15.0 landed
-
In pg_dump, use simplehash.h to look up dumpable objects by OID.
- 92316a4582a5 15.0 cited