pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Rafia Sabih <rafia.pghackers@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: adding partitioned tables to publications
Date: Tue, 28 Jan 2020 10:11:35 +0100
Message-ID: <f3e27805-3e23-970c-62b0-bb7b5c2f0415@2ndquadrant.com> (raw)
In-Reply-To: <CA+HiwqGiFpkHxx0mc2zpdJLGzfqEaqsdqUZurNto9kbkwzcQ1w@mail.gmail.com>
References: <CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com>
	<CA+HiwqF7JD0CLkN12KNuGsf5GfaLuVb-Nc6+nTyL_iOhrSuA0g@mail.gmail.com>
	<CA+HiwqFWK3raKUU5Fp789jBsju-pYVpAiw0OsuO5sMX1CkYwFQ@mail.gmail.com>
	<b1e7d3c5-d4f8-2bc6-80a1-18b18c5db347@2ndquadrant.com>
	<CA+HiwqFwZV4F5sznWvgqf4eR6SebWLTq--gLVytNdtiCDMn=vg@mail.gmail.com>
	<7a23e60b-ffe8-bce1-5c44-db48d3bc163e@2ndquadrant.com>
	<CA+HiwqGZuouqjvWGv2MZ3EOyVej2_6Z=Yv2GHia4Mfk+YY_fHA@mail.gmail.com>
	<CA+HiwqGUZJYaJSM5cPKKFrFSJbTsDyJ9o4Vd=M2d7i5brKvGbA@mail.gmail.com>
	<b6d8519b-353f-1949-79b5-460a6712e20f@2ndquadrant.com>
	<CA+HiwqHScTtXD97yC_ZRLk7TXf+0HYH+UeDvACf2Q-LBH-2ctw@mail.gmail.com>
	<CA+FpmFfKmsNww_C5hWU-=wg9h3cyV7vZcCUKWrrhtLkteUtY4w@mail.gmail.com>
	<CA+HiwqE2ie6_T01fMzsf7c5=hCGoVdj2yTStCJ78zOmayMVWbw@mail.gmail.com>
	<825b31ea-ad9f-21d1-29b6-2a494513458d@2ndquadrant.com>
	<CA+HiwqEqm3xvnMHjstkrECrpVv9R7YgYYpRHHVrffSvA9Zrf9g@mail.gmail.com>
	<CA+HiwqGiFpkHxx0mc2zpdJLGzfqEaqsdqUZurNto9kbkwzcQ1w@mail.gmail.com>

On 2020-01-23 11:10, Amit Langote wrote:
> On Wed, Jan 22, 2020 at 2:38 PM Amit Langote<amitlangote09@gmail.com>  wrote:
>> Other than that, the updated patch contains following significant changes:
>>
>> * Changed pg_publication.c: GetPublicationRelations() so that any
>> published partitioned tables are expanded as needed
>>
>> * Since the pg_publication_tables view is backed by
>> GetPublicationRelations(), that means subscriptioncmds.c:
>> fetch_table_list() no longer needs to craft a query to include
>> partitions when needed, because partitions are included at source.
>> That seems better, because it allows to limit the complexity
>> surrounding publication of partitioned tables to the publication side.
>>
>> * Fixed the publication table DDL to spot more cases of tables being
>> added to a publication in a duplicative manner.  For example,
>> partition being added to a publication which already contains its
>> ancestor and a partitioned tables being added to a publication
>> (implying all of its partitions are added) which already contains a
>> partition
> On second thought, this seems like an overkill.  It might be OK after
> all for both a partitioned table and its partitions to be explicitly
> added to a publication without complaining of duplication. IOW, it's
> the user's call whether it makes sense to do that or not.

This structure looks good now.

However, it does seem unfortunate that in pg_get_publication_tables() we 
need to postprocess the result of GetPublicationRelations().  Since 
we're already changing the API of GetPublicationRelations(), couldn't we 
also make it optionally not include partitioned tables?

For the test, perhaps add test cases where partitions are attached and 
detached so that we can see whether their publication relcache 
information is properly updated.  (I'm not doubting that it works, but 
it would be good to have a test for, in case of future restructuring.)

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (86+ messages)  latest in thread

Message-ID: <f3e27805-3e23-970c-62b0-bb7b5c2f0415@2ndquadrant.com>
Permalink:  ../f3e27805-3e23-970c-62b0-bb7b5c2f0415@2ndquadrant.com/
Also on:    postgresql.org/message-id/f3e27805-3e23-970c-62b0-bb7b5c2f0415@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, amitlangote09@gmail.com, rafia.pghackers@gmail.com
  Subject: Re: adding partitioned tables to publications
  In-Reply-To: <f3e27805-3e23-970c-62b0-bb7b5c2f0415@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox