public inbox for [email protected]  
help / color / mirror / Atom feed
From: Álvaro Herrera <[email protected]>
To: jian he <[email protected]>
Cc: Xuneng Zhou <[email protected]>
Cc: Navneet Kumar <[email protected]>
Cc: [email protected]
Subject: Re: support virtual generated column not null constraint
Date: Fri, 21 Mar 2025 11:18:00 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CACJufxEoYA5ScUr2=CmA1xcpaS_1ixneDbEkVU77X1ctGxY2mA@mail.gmail.com>

On 2025-Mar-20, jian he wrote:

> ATRewriteTable:
>         for (i = 0; i < newTupDesc->natts; i++)
>         {
>             Form_pg_attribute attr = TupleDescAttr(newTupDesc, i);
>             if (attr->attnotnull && !attr->attisdropped)
>             {
>                 if (attr->attgenerated != ATTRIBUTE_GENERATED_VIRTUAL)
>                     notnull_attrs = lappend_int(notnull_attrs, i);
>                 else
>                     notnull_virtual_attrs = lappend_int(notnull_virtual_attrs,
>                                                         attr->attnum);
>             }
>         }
> this is kind of ugly? notnull_virtual_attrs is 1 based, notnull_attrs
> is 0 based.
> I want to change it all to 1 based. see v5-0002

Yeah, this inconsistency bothered me too.  I have pushed your 0002 now,
which means your 0001 needs a small rebase.  I'm going to leave 0001 for
Peter to commit, as it's mostly his turf.

> + * We implement this by consing up a NullTest node for each virtual
> trivial question.
>  I googled, and still found any explanation of the word "consing up".

https://www.pc-freak.net/files/the-hacker-disctionary.html

You could change "cons up" to "manufacture" in that comment and get
about the same meaning.  Maybe have a look at
  git grep -C3 -E 'cons(|ing|ed) up'

I think the ChatGPT answer quoted by Zhou is roughly on point.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"El que vive para el futuro es un iluso, y el que vive para el pasado,
un imbécil" (Luis Adler, "Los tripulantes de la noche")





view thread (17+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: support virtual generated column not null constraint
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox