Re: wrong comments in rewriteTargetListIU

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Amit Langote <amitlangote09(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: wrong comments in rewriteTargetListIU
Date: 2025-06-17 05:27:28
Message-ID: 5703378d-6559-47fd-b567-e0053fd0273a@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10.04.25 11:46, Amit Langote wrote:
> Hi,
>
> On Thu, Apr 10, 2025 at 5:58 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>>
>> hi.
>>
>> in function, rewriteTargetListIU
>> we have:
>>
>> for (attrno = 1; attrno <= numattrs; attrno++)
>> {
>> /*
>> * Can only insert DEFAULT into generated columns, regardless of
>> * any OVERRIDING clauses.
>> */
>> if (att_tup->attgenerated && !apply_default)
>> }
>>
>> I think the above comments are wrong, since there are no
>> OVERRIDING clauses for the generated column.
>
> Hmm, I'm not sure that is quite right. See 17958972fe3b which added
> the comment, especially the test cases that it adds.

Jian is right, there are no OVERRIDING clauses for generated columns,
and the shown code also doesn't check for them, so the comment doesn't
match the code. I suspect that commit 17958972fe3b slightly confused
generated and identity columns in this case. I suggest to remove the
half-sentence "regardless of ...".

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-06-17 05:38:11 Re: Avoid possible dereference null pointer (contrib/postgres_fdw/postgres_fdw.c)
Previous Message Peter Eisentraut 2025-06-17 05:21:13 Re: confusing message in check_tuple