From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: adding partitioned tables to publications |
Date: | 2019-10-11 06:05:54 |
Message-ID: | CA+HiwqEgn5da9KvWP4y0rBjcMtHdRao01Lr6TgTw78+UGceJwQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello Rafia,
Great to hear that you are interested in this feature and thanks for
testing the patch.
On Thu, Oct 10, 2019 at 10:13 PM Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com> wrote:
> Lately I was exploring logical replication feature of postgresql and I found this addition in the scope of feature for partitioned tables a useful one.
>
> In order to understand the working of your patch a bit more, I performed an experiment wherein I created a partitioned table with several children and a default partition at the publisher side and normal tables of the same name as parent, children, and default partition of the publisher side at the subscriber side. Next I established the logical replication connection and to my surprise the data was successfully replicated from partitioned tables to normal tables and then this error filled the logs,
> LOG: logical replication table synchronization worker for subscription "my_subscription", table "parent" has started
> ERROR: table "public.parent" not found on publisher
>
> here parent is the name of the partitioned table at the publisher side and it is present as normal table at subscriber side as well. Which is understandable, it is trying to find a normal table of the same name but couldn't find one, maybe it should not worry about that now also if not at replication time.
>
> Please let me know if this is something expected because in my opinion this is not desirable, there should be some check to check the table type for replication. This wasn't important till now maybe because only normal tables were to be replicated, but with the extension of the scope of logical replication to more objects such checks would be helpful.
Thanks for sharing this case. I hadn't considered it, but you're
right that it should be handled sensibly. I have fixed table sync
code to handle this case properly. Could you please check your case
with the attached updated patch?
> On a separate note was thinking for partitioned tables, wouldn't it be cleaner to have something like you create only partition table at the subscriber and then when logical replication starts it creates the child tables accordingly. Or would that be too much in future...?
Hmm, we'd first need to built the "automatic partition creation"
feature to consider doing something like that. I'm sure you'd agree
that we should undertake that project separately from this tiny
logical replication usability improvement project. :)
Thanks again.
Regards,
Amit
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Support-adding-partitioned-tables-to-publication.patch | application/octet-stream | 48.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-10-11 07:16:54 | Re: dropping column prevented due to inherited index |
Previous Message | Craig Ringer | 2019-10-11 05:13:33 | Re: let's make the list of reportable GUCs configurable (was Re: Add %r substitution for psql prompts to show recovery status) |