Re: Update comment in ExecPartitionCheck

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Update comment in ExecPartitionCheck
Date: 2017-09-01 09:28:17
Message-ID: 37bd2558-ce93-688b-65b7-771d8dc0718a@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017/08/26 2:28, Robert Haas wrote:
> On Tue, Jul 4, 2017 at 4:55 AM, Etsuro Fujita
> <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp> wrote:
>> This comment in an error handling in ExecPartitionCheck():
>>
>> if (!ExecCheck(resultRelInfo->ri_PartitionCheckExpr, econtext))
>> {
>> char *val_desc;
>> Relation orig_rel = rel;
>>
>> /* See the comment above. */
>> if (resultRelInfo->ri_PartitionRoot)
>>
>> should be updated because we don't have any comment on that above in the
>> code. Since we have a comment on that in ExecConstraints() defined just
>> below that function, I think the comment should be something like this: "See
>> the comment in ExecConstraints().". Attached is a patch for that.
>
> Hrm. I'm not sure I understand which comment in ExecConstraints()
> this is supposed to refer to. Maybe we need to think a bit harder
> about how to make this clear.

The comment in ExecConstraints is this:

/*
* If the tuple has been routed, it's been converted to the
* partition's rowtype, which might differ from the root
* table's. We must convert it back to the root table's
* rowtype so that val_desc shown error message matches the
* input tuple.
*/
if (resultRelInfo->ri_PartitionRoot)

How about replacing the comment "See the comment above." in
ExecPartitionCheck with something like this: "If the tuple has been
routed, convert it from the partition's rowtype to the root table's. See
the comment in ExecConstraints().". I think that would make it easy to
specify that comment in ExecConstrains. I'd like to propose to update
the same comments in other places as well, just for consistency.

PFA an updated version of the patch.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
ExecPartitionCheck-comment-fix-v2.patch text/plain 1.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2017-09-01 09:30:38 Re: Minor code improvement to postgresGetForeignPlan
Previous Message Masahiko Sawada 2017-09-01 08:59:47 Re: CLUSTER command progress monitor