| From: | solai v <solai(dot)cdac(at)gmail(dot)com> |
|---|---|
| To: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
| Cc: | Alberto Piai <alberto(dot)piai(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
| Subject: | Re: Adding a stored generated column without long-lived locks |
| Date: | 2026-09-01 09:02:29 |
| Message-ID: | CAF0whufpDUi_=iqbUFwaFUg7ji6yXdw3fKt-7=E3=wD-UYbxTQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
I tested v10 of the patch on the latest PostgreSQL master.
The patch applied cleanly, and PostgreSQL built successfully. git diff
--check completed without any issues.
I also ran: make check and all regression tests passed.
For the main functionality, I created a table with 100,000 existing
rows, backfilled the column, and added the required CHECK constraint:
CHECK (generated_value IS NOT DISTINCT FROM id * 2)
The following command then completed successfully:
ALTER TABLE test_gen_v10
ALTER COLUMN generated_value
ADD GENERATED USING CONSTRAINT test_gen_v10_check STORED;
The column was confirmed as: generated always as (id * 2) stored
I also tested the conversion with a table containing 1,000,000 rows.
The relation file path and size remained unchanged before and after
the conversion:
Before:
filepath: base/5/16393
size: 44,285,952 bytes (42 MB)
After:
filepath: base/5/16393
size: 44,285,952 bytes (42 MB)
This indicates that the table was not physically rewritten during the
conversion.
Overall, the v10 patch worked as expected in my testing.
Regards,
solai
| From | Date | Subject | |
|---|---|---|---|
| Next Message | jian he | 2026-09-01 09:04:34 | Re: foreign_key test is sensitive to the OID counter |
| Previous Message | Cagri Biroglu | 2026-09-01 08:42:06 | Re: Per-table resync for logical replication subscriptions |