Re: adding partitioned tables to publications
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Rafia Sabih <rafia.pghackers@gmail.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-11-20T07:58:04Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix RELCACHE_FORCE_RELEASE issue
- 12fb189bfeaf 13.0 landed
-
Allow publishing partition changes via ancestors
- 83fd4532a721 13.0 landed
-
Add logical replication support to replicate into partitioned tables
- f1ac27bfda6c 13.0 landed
-
Refactor code to look up local replication tuple
- d8653f468789 13.0 landed
-
Some refactoring of logical/worker.c
- 97ee604d9bce 13.0 landed
-
Prepare to support non-tables in publications
- c314c147c056 13.0 landed
-
Support adding partitioned tables to publication
- 17b9e7f9fe23 13.0 landed
On 2019-11-12 02:11, Amit Langote wrote:
>> I don't understand why you go through great lengths to ensure that the
>> relkinds match between publisher and subscriber. We already ensure that
>> only regular tables are published and only regular tables are allowed as
>> subscription target. In the future, we may want to allow further
>> combinations. What situation are you trying to address here?
> I'd really want to see the requirement for relkinds to have to match
> go away, but as you can see, this patch doesn't modify enough of
> pgoutput.c and worker.c to make that possible. Both the code for the
> initital syncing and that for the subsequent real-time replication
> assume that both source and target are regular tables. So even if
> partitioned tables can now be in a publication, they're never sent in
> the protocol messages, only their leaf partitions are. Initial
> syncing code can be easily modified to support any combination of
> source and target relations, but changes needed for real-time
> replication seem non-trivial. Do you think we should do that before
> we can say partitioned tables support logical replication?
My question was more simply why you have this check:
+ /*
+ * Cannot replicate from a regular to a partitioned table or vice
+ * versa.
+ */
+ if (local_relkind != pt->relkind)
+ ereport(ERROR,
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot use relation \"%s.%s\" as logical
replication target",
+ rv->schemaname, rv->relname),
It doesn't seem necessary. What happens if you remove it?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services