Re: Needless additional partition check in INSERT?
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: David Rowley <david.rowley@2ndquadrant.com>, Simon Riggs <simon@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Robert Haas <robertmhaas@gmail.com>, Amit Langote <amitlangote09@gmail.com>, Amit Khandekar <amitdkhan.pg@gmail.com>, 2q-peter@alvin.alvh.no-ip.org, 2q-petr@alvin.alvh.no-ip.org
Date: 2018-06-14T14:23:28Z
Lists: pgsql-hackers
On 2018-Jun-14, Amit Langote wrote: > 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. To me, the ideal would be that re-routing occurs if the partition constraint fails. The fact that the partition constraint is now separate from the rest of the tuple constraints makes this easy to implement, I think. > > 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. Ah, okay, so this is already documented not to work. I guess it's a reasonable addition for the next release. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Don't needlessly check the partition contraint twice
- 5b0c7e2f757a 11.0 landed