From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com> |
Cc: | Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: adding partitioned tables to publications |
Date: | 2019-12-11 15:48:25 |
Message-ID: | b6d8519b-353f-1949-79b5-460a6712e20f@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2019-12-06 08:48, Amit Langote wrote:
> 0001: Adding a partitioned table to a publication implicitly adds all
> its partitions. The receiving side must have tables matching the
> published partitions, which is typically the case, because the same
> partition tree is defined on both nodes.
This looks pretty good to me now. But you need to make all the changed
queries version-aware so that you can still replicate from and to older
versions. (For example, pg_partition_tree is not very old.)
This part looks a bit fishy:
+ /*
+ * If either table is partitioned, skip copying. Individual
partitions
+ * will be copied instead.
+ */
+ if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE ||
+ remote_relkind == RELKIND_PARTITIONED_TABLE)
+ {
+ logicalrep_rel_close(relmapentry, NoLock);
+ return;
+ }
I don't think you want to filter out a partitioned table on the local
side, since (a) COPY can handle that, and (b) it's (as of this patch) an
error to have a partitioned table in the subscription table set.
I'm not a fan of the new ValidateSubscriptionRel() function. It's too
obscure, especially the return value. Doesn't seem worth it.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-12-11 15:49:13 | Re: Optimization of NestLoop join in the case of guaranteed empty inner subtree |
Previous Message | Stephen Frost | 2019-12-11 15:45:25 | Re: Fetching timeline during recovery |