| From: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com> |
|---|---|
| To: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint |
| Date: | 2026-01-14 21:01:58 |
| Message-ID: | c2d6c637-8952-423c-b84c-bd805e8e4143@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 06/07/25 23:24, jian he wrote:
> hi.
> rebased only.
+--test no table rewrite happen
+ALTER TABLE gtest20 ALTER COLUMN b SET EXPRESSION AS (a * 4), ADD
COLUMN C int default 11;
+SELECT pa.attnum,pa.attname,attmissingval
+FROM pg_attribute pa
+JOIN pg_attrdef patt ON pa.attrelid = patt.adrelid AND pa.attnum =
patt.adnum
+WHERE pa.attrelid = 'gtest20'::regclass
Not sure if I understand the goal of this query. Is to check if the
table was not rewritten after an update on the virtual generated
column? If that's the case, I've tested this query by updating the
expression from a STORED generated column and it return the same
results, before and after the alter table, so I'm not sure if it's the
best way to test this, or I'm missing something?
Perhaps we could use pg_relation_filenode() and use \gset to store the
value on a variable before the ALTER TABLE execution and check if the
value is the same after the ALTER TABLE SET EXPRESSION is executed.
Please see the attached diff for reference.
--
Matheus Alcantara
EDB: https://www.enterprisedb.com
| Attachment | Content-Type | Size |
|---|---|---|
| test-no-table-rewrite.diff.nocfbot | text/plain | 2.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kirill Reshke | 2026-01-14 21:03:07 | Re: PL/Python initialization cleanup |
| Previous Message | Daniel Gustafsson | 2026-01-14 20:59:02 | Re: how to gate experimental features (SQL/PGQ) |