Re: Added schema level support for publication.

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Amit Kapila <amit.kapila16@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>, "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>, Greg Nancarrow <gregn4422@gmail.com>, Ajin Cherian <itsajin@gmail.com>, "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>, Rahila Syed <rahilasyed90@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: 2021-08-14T09:32:04Z
Lists: pgsql-hackers
On 13.08.21 04:59, Amit Kapila wrote:
>> Even if we drop all tables added to the publication from it, 'pubkind'
>> doesn't go back to 'empty'. Is that intentional behavior? If we do
>> that, we can save the lookup of pg_publication_rel and
>> pg_publication_schema in some cases, and we can switch the publication
>> that was created as FOR SCHEMA to FOR TABLE and vice versa.
>>
> Do we really want to allow users to change a publication that is FOR
> SCHEMA to FOR TABLE? I see that we don't allow to do that FOR TABLES.
> postgres=# Alter Publication pub add table tbl1;
> ERROR:  publication "pub" is defined as FOR ALL TABLES
> DETAIL:  Tables cannot be added to or dropped from FOR ALL TABLES publications.

I think the strict separation between publication-for-tables vs. 
publication-for-schemas is a mistake.  Why can't I have a publication 
that publishes tables t1, t2, t3, *and* schemas s1, s2, s3.  Also note 
that we have a pending patch to add sequences support to logical 
replication.  So eventually, a publication will be able to contain a 
bunch of different objects of different kinds.



Commits

  1. Include schema/table publications even with exclude options in dump.

  2. Rename some enums to use TABLE instead of REL.

  3. Add tap tests for the schema publications.

  4. Allow publishing the tables of schema.

  5. In pg_dump, use simplehash.h to look up dumpable objects by OID.