Re: support virtual generated column not null constraint

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Xuneng Zhou <xunengzhou(at)gmail(dot)com>, Navneet Kumar <thanit3111(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: support virtual generated column not null constraint
Date: 2025-03-21 10:18:00
Message-ID: 202503211018.lsboinfrjn7w@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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")

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2025-03-21 10:28:23 Re: Snapshot related assert failure on skink
Previous Message vignesh C 2025-03-21 10:12:50 Re: speedup COPY TO for partitioned table.