Re: wrong comments in rewriteTargetListIU

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: wrong comments in rewriteTargetListIU
Date: 2025-06-17 18:50:46
Message-ID: CAEZATCVYYiDf9ByVPDinz6RMF30hAhmqKs8r7QoHfv-rbKHD=A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 17 Jun 2025 at 13:56, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> On Tue, Jun 17, 2025 at 7:42 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
> >
> > However, I see your point that it contrasts with the attidentity code
> > just above.
> >
> > Perhaps a way to resolve this would be to rewrite the comment something
> > like:
> >
> > /*
> > * Although inserting into a GENERATED BY DEFAULT identity column
> > * is allowed, apply the default if OVERRIDING USER VALUE is
> > * specified.
> > */
> > if (att_tup->attidentity == ATTRIBUTE_IDENTITY_BY_DEFAULT &&
> > override == OVERRIDING_USER_VALUE)
> > apply_default = true;
> >
> > /*
> > * Can only insert DEFAULT into generated columns. (The OVERRIDING
> > * clause does not apply to generated columns, so we don't consider
> > * it here.)
> > */
> > if (att_tup->attgenerated && !apply_default)
> > {
> >
> I think this comment is better than the master comments.
>
> the master comments
> /*
> * Can only insert DEFAULT into generated columns, regardless of
> * any OVERRIDING clauses.
> */
> as a non-native English speaker, i interpret this as it implies that
> generated columns
> can have OVERRIDING clauses in some scenarios.

OK, fair enough. The suggested update looks reasonable to me.

Regards,
Dean

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-06-17 19:23:51 Re: minimum Meson version
Previous Message Nathan Bossart 2025-06-17 18:41:54 Re: add function for creating/attaching hash table in DSM registry