Stored generated columns are NULL in transition tables of partitioned tables

Started by shihao zhong14 days ago1 messageshackers
Jump to latest
#1shihao zhong
zhong950419@gmail.com

Hi hackers,

If a partition needs tuple conversion, the NEW TABLE of an AFTER trigger
on the parent shows NULL for stored generated columns.

create table t (a int, junk int, b int,
g int generated always as (b * 2) stored)
partition by range (a);
alter table t drop column junk;
create table t1 partition of t for values from (0) to (100);
create trigger tr after insert on t referencing new table as n
for each statement execute function show_n();
copy t (a, b) from stdin;
1 10
\.

0001 fixes it and 0002 adds a test. This affects 14 to 19.

003 is for master only. It passes the original tuple again in ExecInsert(),
which
398eb35f001 stopped doing.

Thanks,
Shihao

Attachments:

t258380_1
v1-0002-Test-stored-generated-columns-in-transition-tables-o.patchapplication/octet-stream; name=v1-0002-Test-stored-generated-columns-in-transition-tables-o.patchDownload+32-1
v1-0001-Fix-stored-generated-columns-in-transition-tables-of.patchapplication/octet-stream; name=v1-0001-Fix-stored-generated-columns-in-transition-tables-of.patchDownload+15-8
v1-0003-Pass-the-original-tuple-to-AFTER-ROW-triggers-in-Exe.patchapplication/octet-stream; name=v1-0003-Pass-the-original-tuple-to-AFTER-ROW-triggers-in-Exe.patchDownload+2-3