diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index b22de78..4904885 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -2112,6 +2112,7 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, if (map != NULL) { tuple = do_convert_tuple(tuple, map); + ExecSetSlotDescriptor(slot, tupdesc); ExecStoreTuple(tuple, slot, InvalidBuffer, false); } } diff --git a/src/test/regress/expected/updatable_views.out b/src/test/regress/expected/updatable_views.out index caca81a..eab5c03 100644 --- a/src/test/regress/expected/updatable_views.out +++ b/src/test/regress/expected/updatable_views.out @@ -2368,8 +2368,8 @@ DETAIL: Failing row contains (-1, invalid). DROP VIEW v1; DROP TABLE t1; -- check that an auto-updatable view on a partitioned table works correctly -create table pt (a int, b int) partition by range (a, b); -create table pt1 (b int not null, a int not null) partition by range (b); +create table pt (a int, b int, v varchar) partition by range (a, b); +create table pt1 (b int not null, v varchar, a int not null) partition by range (b); create table pt11 (like pt1); alter table pt11 drop a; alter table pt11 add a int; @@ -2412,18 +2412,19 @@ select table_name, column_name, is_updatable ------------+-------------+-------------- ptv | a | YES ptv | b | YES -(2 rows) + ptv | v | YES +(3 rows) insert into ptv values (1, 2); select tableoid::regclass, * from pt; - tableoid | a | b -----------+---+--- - pt11 | 1 | 2 + tableoid | a | b | v +----------+---+---+--- + pt11 | 1 | 2 | (1 row) create view ptv_wco as select * from pt where a = 0 with check option; insert into ptv_wco values (1, 2); ERROR: new row violates check option for view "ptv_wco" -DETAIL: Failing row contains (1, 2). +DETAIL: Failing row contains (1, 2, null). drop view ptv, ptv_wco; drop table pt, pt1, pt11; diff --git a/src/test/regress/sql/updatable_views.sql b/src/test/regress/sql/updatable_views.sql index 6a9958d..2ede44c 100644 --- a/src/test/regress/sql/updatable_views.sql +++ b/src/test/regress/sql/updatable_views.sql @@ -1114,8 +1114,8 @@ DROP VIEW v1; DROP TABLE t1; -- check that an auto-updatable view on a partitioned table works correctly -create table pt (a int, b int) partition by range (a, b); -create table pt1 (b int not null, a int not null) partition by range (b); +create table pt (a int, b int, v varchar) partition by range (a, b); +create table pt1 (b int not null, v varchar, a int not null) partition by range (b); create table pt11 (like pt1); alter table pt11 drop a; alter table pt11 add a int;