Re: support virtual generated column not null constraint - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: support virtual generated column not null constraint
Date
Msg-id 202503211018.lsboinfrjn7w@alvherre.pgsql
Whole thread Raw
In response to Re: support virtual generated column not null constraint  (jian he <jian.universality@gmail.com>)
Responses Re: support virtual generated column not null constraint
List pgsql-hackers
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")



pgsql-hackers by date:

Previous
From: vignesh C
Date:
Subject: Re: speedup COPY TO for partitioned table.
Next
From: Tomas Vondra
Date:
Subject: Re: Snapshot related assert failure on skink