From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Jürgen Strobel <juergen+postgresql(at)strobel(dot)info> |
Cc: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Amit Langote <amitlangote09(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation |
Date: | 2018-11-09 17:07:12 |
Message-ID: | 20181109170712.pfn55lab5j7oae4v@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers |
On 2018-Nov-09, Jürgen Strobel wrote:
> Regarding your example, what I expected is that *both* inserts would
> consistently result in a tuple of (1, 42) since p should route the
> insert to p1 and use p1's defaults. The current inconsistent behavior is
> the heart of the bug.
I think that would be sensible behavior, as long as the partition
doesn't override values for the partitioning column -- i.e. if the
default values don't re-route the tuple to another partition, I think we
should use the partition's default rather than the parent. This says we
should expand defaults after routing. However, can we really route if
we haven't expanded defaults? In general, we may be lacking values for
some columns of the partition key. Another point: if we've already
expanded defaults when processing at the parent level, when we reach the
partition we don't know which values are still missing default
expansion, or which defaults coming from the parent ought to be
re-expanded.
So this looks to be a bit of a landmine.
In any case it seems really hard to see this is as a bug that we would
fix in back-branches.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Ing. Gianluca Alberici | 2018-11-09 18:12:37 | Re: Ris: BUG #15482: (SOLVED ?) Foreign keys to a partition (NOT A PARTITIONED) break the server |
Previous Message | Jürgen Strobel | 2018-11-09 16:46:04 | BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Verite | 2018-11-09 17:23:10 | Re: Alternative to \copy in psql modelled after \g |
Previous Message | David G. Johnston | 2018-11-09 16:49:50 | Re: Alternative to \copy in psql modelled after \g |