Re: pg18: Virtual generated columns are not (yet) safe when superuser selects from them - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: pg18: Virtual generated columns are not (yet) safe when superuser selects from them
Date
Msg-id 07575efa-a62d-4b72-b4ef-3337112449e2@eisentraut.org
Whole thread Raw
In response to Re: pg18: Virtual generated columns are not (yet) safe when superuser selects from them  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On 23.06.25 18:11, jian he wrote:
> seems we didn't check the ALTER TABLE case.
> 
> CREATE TYPE double_int as (a int, b int);
> CREATE TABLE y (a int);
> alter table y add column b double_int GENERATED ALWAYS AS ((a * 2, a *
> 3)) VIRTUAL;
> 
> in ATExecAddColumn, we can change it to:
>      CheckAttributeType(NameStr(attribute->attname),
> attribute->atttypid, attribute->attcollation,
>                         list_make1_oid(rel->rd_rel->reltype),
>                         (attribute->attgenerated ==
> ATTRIBUTE_GENERATED_VIRTUAL ? CHKATYPE_IS_VIRTUAL : 0));

Yes, this is an existing fault separate from this patch.  I have pushed 
a fix for this along these lines.




pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: pgsql: Introduce pg_shmem_allocations_numa view
Next
From: Pavel Luzanov
Date:
Subject: Re: Things I don't like about \du's "Attributes" column