pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jürgen Strobel <juergen+postgresql@strobel.info>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
Date: Fri, 9 Nov 2018 22:03:12 +0100
Message-ID: <00ca74fd-4f88-877a-823b-2891f3f212ce@strobel.info> (raw)
In-Reply-To: <20181109170712.pfn55lab5j7oae4v@alvherre.pgsql>
References: <20181109170712.pfn55lab5j7oae4v@alvherre.pgsql>

On 2018-11-09 18:07, Alvaro Herrera wrote:
> 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.
> 

I am slightly confused now, I thought this landmine was already fixed in
master and what remains is only whether to backport it or not? Which I
guess depends on whether this is classified as a bug or not.

Since the fix has the potential to break current applications and the
documentation is vague about wanted behavior I think it would be
sensible to add a warning only, even if we agree to call it a bug.

Best regards,
Jürgen




view thread (43+ messages)  latest in thread

Message-ID: <00ca74fd-4f88-877a-823b-2891f3f212ce@strobel.info>
Permalink:  ../00ca74fd-4f88-877a-823b-2891f3f212ce@strobel.info/
Also on:    postgresql.org/message-id/00ca74fd-4f88-877a-823b-2891f3f212ce@strobel.info

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: juergen+postgresql@strobel.info, alvherre@2ndquadrant.com, Langote_Amit_f8@lab.ntt.co.jp, amitlangote09@gmail.com, ashutosh.bapat@enterprisedb.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
  In-Reply-To: <00ca74fd-4f88-877a-823b-2891f3f212ce@strobel.info>
  References: <20181109170712.pfn55lab5j7oae4v@alvherre.pgsql> <00ca74fd-4f88-877a-823b-2891f3f212ce@strobel.info>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox