Re: NOT NULL constraints on range partition key columns

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: NOT NULL constraints on range partition key columns
Date: 2017-05-16 09:56:30
Message-ID: 6fd1a00e-2963-06f9-2baf-26dcc9fbc240@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/05/16 4:29, Robert Haas wrote:
> On Mon, May 15, 2017 at 9:12 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> Can't we allow NULL to get inserted into the partition (leaf
>> partition) if the user uses the partition name in Insert statement?
>
> That would be terrible behavior - the behavior of tuple routing should
> match the enforced constraints.
>
>> For root partitions, I think for now giving an error is okay, but once
>> we have default partitions (Rahila's patch), we can route NULLS to
>> default partition.
>
> Yeah, that's exactly why I think we should make the change Amit is
> proposing here. If we don't, then we won't be able to accept NULL
> values even after we have the default partitioning stuff.

Attached is a patch for consideration. There are 2 actually, but maybe
they should be committed together if we decide do go with this.

Thanks,
Amit

Attachment Content-Type Size
0001-No-explicit-NOT-NULL-constraints-on-range-partition-.patch text/x-diff 12.2 KB
0002-Change-error-when-tuple-routing-sees-NULL-in-range-k.patch text/x-diff 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message amul sul 2017-05-16 10:00:00 Re: [POC] hash partitioning
Previous Message Ashutosh Bapat 2017-05-16 09:51:27 Re: Bug in ExecModifyTable function and trigger issues for foreign tables