Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Jürgen Strobel <juergen+postgresql(at)strobel(dot)info>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Amit Langote <amitlangote09(at)gmail(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-12 14:00:51
Message-ID: 20181112140051.yv5m77esq5jz6rkg@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 2018-Nov-12, Jürgen Strobel wrote:

> With all due respect I suspect your view of implementation issues biases
> your judgement here. For me the partition's default handling was
> completely unexpected, especially with the documentation silent about
> default-applying behavior, and inconsistent with how check constraints
> work with partitions.

This is valuable input. It would be good to have more opinions from
users, particularly those accustomed to how things work in other RDBMS
systems, so that we can inform our own opinions on how we should make it
work here in PG going forward.

One of the guiding principles that I think we should hold for
partitioning is that operating directly into the partition should be
seen as only an optimization compared to inserting into the parent table
-- thus it should not behave differently. Applying different default
values depending on where you're inserting into goes counter to that
principle.

> Maybe there's another way to implement this. Like mark early and apply
> defaults later, and handle meta data like constraints. Sorry if this
> sounds stupid.

It does not sound stupid -- it seems exactly what I was thinking.
Admittedly, it's a bit hand-wavy and we'd need to understand more how it
work in more detail, as well as how it works currently (and why it
does).

However, I'm not ATM in a position to design or write a patch for this.

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-11-12 16:33:04 Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
Previous Message Jürgen Strobel 2018-11-12 13:52:11 Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeremy Finzel 2018-11-12 14:32:12 Re: Changes to error handling for background worker initialization?
Previous Message Michael Paquier 2018-11-12 13:55:41 Re: move PartitionBoundInfo creation code