pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Jürgen Strobel <juergen+postgresql@strobel.info>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
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: Tue, 13 Nov 2018 18:11:42 +0100
Message-ID: <eae202e384858edef9647f83c7308932a135ae12.camel@2ndquadrant.com> (raw)
In-Reply-To: <dc3d80bb-87ab-496b-b6ce-396bba0eccda@strobel.info>
References: <20181112140051.yv5m77esq5jz6rkg@alvherre.pgsql>
	<5662.1542040384@sss.pgh.pa.us>
	<ebcf4a32-cfee-8a8f-525d-6ceaa72c75d8@strobel.info>
	<10299.1542067039@sss.pgh.pa.us>
	<dc3d80bb-87ab-496b-b6ce-396bba0eccda@strobel.info>

On Tue, 2018-11-13 at 13:44 +0100, Jürgen Strobel wrote:
> On 2018-11-13 00:57, Tom Lane wrote:
> > =?UTF-8?Q?J=c3=bcrgen_Strobel?= <juergen+postgresql@strobel.info>
> > writes:
> > > On 2018-11-12 17:33, Tom Lane wrote:
> > > > I'm not entirely convinced that I buy that argument, especially
> > > > not in
> > > > a case like this where it introduces logical inconsistencies
> > > > where there
> > > > otherwise wouldn't be any.
> > > I think I missed something, what are the *introduced* logical
> > > problems?
> > 
> > What to do if a partition introduces a default value that would
> > force
> > re-routing to some other partition.
> 
> I would claim this is a problem which already exists with the current
> behavior:
> 

I think the question is what part of the current behavior is
intentional (albeit with corner-cases not handled or rejected
properly), and what part is just not thought through. Not sure.

> a) If a tuple is inserted through the parent it's ignored and
> useless.
> b) If a tuple is inserted through the partition it can lead to
> inconsistency and a constraint violation (possibly rectifiable by a
> re-route which I think we all agree is out of the question).
> 

Yeah, allowing defaults mismatching the partition seems like a can of
worms. We certainly should not allow such rows to be inserted in the
partition. Routing them somewhere else seems tricky, so perhaps it'd be
better to just error-out in this case.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (44+ messages)  latest in thread

Message-ID: <eae202e384858edef9647f83c7308932a135ae12.camel@2ndquadrant.com>
Permalink:  ../eae202e384858edef9647f83c7308932a135ae12.camel@2ndquadrant.com/
Also on:    postgresql.org/message-id/eae202e384858edef9647f83c7308932a135ae12.camel@2ndquadrant.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, juergen+postgresql@strobel.info, tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, Langote_Amit_f8@lab.ntt.co.jp, 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: <eae202e384858edef9647f83c7308932a135ae12.camel@2ndquadrant.com>

* 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