Re: Needless additional partition check in INSERT? - Mailing list pgsql-hackers

From David Rowley
Subject Re: Needless additional partition check in INSERT?
Date
Msg-id CAKJS1f8zacEwy4b+Nn45+TMtOS+QVgptZd2d2NvsapaV=cQriQ@mail.gmail.com
Whole thread Raw
In response to Re: Needless additional partition check in INSERT?  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Responses Re: Needless additional partition check in INSERT?
List pgsql-hackers
On 14 May 2018 at 16:49, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:
> On 2018/05/11 18:43, Amit Khandekar wrote:
>> This looks better (it will avoid unnecessary ExecConstraints() call) :
>>
>> if (resultRelInfo->ri_PartitionRoot == NULL ||
>>      (resultRelInfo->ri_TrigDesc &&
>>       resultRelInfo->ri_TrigDesc->trig_insert_before_row))
>>     check_partition_constr = resultRelInfo->ri_PartitionCheck;
>
> You'd be assigning a List pointer to a bool variable with this.  Maybe you
> meant:
>
>     check_partition_constr = (resultRelInfo->ri_PartitionCheck != NIL);

I also noticed that. Apart from that, I think your version is correct,
but I just don't think it's quite as easy to understand. Although
that's certainly debatable.

For now, I'll refrain from writing v4 unless there's some consensus
that this is a better way to write it.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Incorrect comment in get_partition_dispatch_recurse
Next
From: Chapman Flack
Date:
Subject: SPI/backend equivalent of extended-query Describe(statement)?