Re: Needless additional partition check in INSERT?

From: Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>
Subject: Re: Needless additional partition check in INSERT?
Date: 2018-05-14 05:51:25
Message-ID: CAJ3gD9fbSG5-kdLzZ+zsgKoffcnaz=eKx1sjFOodx=axLXNrOQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 14 May 2018 at 10:30, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> wrote:
> On 14 May 2018 at 16:49, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)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.

Yes, I meant (resultRelInfo->ri_PartitionCheck != NIL)

> 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.

Yes. if the simplicity is becoming debatable, I am ok with either.
That was my own preference.

--
Thanks,
-Amit Khandekar
EnterpriseDB Corporation
The Postgres Database Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2018-05-14 06:17:45 Re: Clock with Adaptive Replacement
Previous Message Michael Paquier 2018-05-14 05:49:55 Temporary WAL segments files not cleaned up after an instance crash