Re: Needless additional partition check in INSERT? - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Needless additional partition check in INSERT?
Date
Msg-id 6dffdb8f-068d-e020-3678-f464054a1753@lab.ntt.co.jp
Whole thread Raw
In response to Re: Needless additional partition check in INSERT?  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Needless additional partition check in INSERT?
List pgsql-hackers
On 2018/06/09 3:41, Alvaro Herrera wrote:
> BTW, while working on this, I was a bit disturbed by the
> execReplication.c changes (namely: if the partitioning is not identical
> on both sides, things are likely to blow up pretty badly), but that's a
> separate topic.

Hmm, yes.  If the partition of a given name on subscription side doesn't
have the same partition constraint as on the publication side,
subscription worker simply fails, which is the right thing to do anyway.

ERROR:  new row for relation "p1" violates partition constraint
DETAIL:  Failing row contains (1, 1).
LOG:  background worker "logical replication worker" (PID 25739) exited
with exit code 1

Maybe, it's a user error to set up logical replication that way.

> I didn't see any tests of logical replication with
> partitioned tables ... Is the current understanding that we don't
> promise those things to work terribly well together?

As far as the documentation is concerned, there is this note on

31.4. Restrictions (Chapter 31. Logical Replication)
https://www.postgresql.org/docs/devel/static/logical-replication-restrictions.html

  Replication is only possible from base tables to base tables. That is,
  the tables on the publication and on the subscription side must be
  normal tables, not views, materialized views, partition root tables, or
  foreign tables. In the case of partitions, you can therefore replicate a
  partition hierarchy one-to-one, but you cannot currently replicate to a
  differently partitioned setup. Attempts to replicate tables other than
  base tables will result in an error.

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: why partition pruning doesn't work?
Next
From: Amit Langote
Date:
Subject: Re: Remove mention in docs that foreign keys on partitioned tablesare not supported