1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

Apply fixes for problems with dropped columns whose types have also been

dropped.  The simplest fix for INSERT/UPDATE cases turns out to be for
preptlist.c to insert NULLs of a known-good type (I used INT4) rather
than making them match the deleted column's type.  Since the representation
of NULL is actually datatype-independent, this should work fine.
I also re-reverted the patch to disable the use_physical_tlist optimization
in the presence of dropped columns.  It still doesn't look worth the
trouble to be smarter, if there are no other bugs to fix.
Added a regression test to catch future problems in this area.
This commit is contained in:
Tom Lane
2003-05-12 00:17:03 +00:00
parent a7c50cd92b
commit d97c9b3662
6 changed files with 167 additions and 27 deletions

View File

@@ -1253,3 +1253,44 @@ select * from p1;
drop table p1 cascade;
NOTICE: Drop cascades to table c1
NOTICE: Drop cascades to constraint p1_a1 on table c1
-- test that operations with a dropped column do not try to reference
-- its datatype
create domain mytype as text;
create temp table foo (f1 text, f2 mytype, f3 text);
insert into foo values('aa','bb','cc');
select * from foo;
f1 | f2 | f3
----+----+----
aa | bb | cc
(1 row)
drop domain mytype cascade;
NOTICE: Drop cascades to table foo column f2
select * from foo;
f1 | f3
----+----
aa | cc
(1 row)
insert into foo values('qq','rr');
select * from foo;
f1 | f3
----+----
aa | cc
qq | rr
(2 rows)
update foo set f3 = 'zz';
select * from foo;
f1 | f3
----+----
aa | zz
qq | zz
(2 rows)
select f3,max(f1) from foo group by f3;
f3 | max
----+-----
zz | qq
(1 row)

View File

@@ -895,3 +895,21 @@ update p1 set a1 = a1 + 1, f2 = upper(f2);
select * from p1;
drop table p1 cascade;
-- test that operations with a dropped column do not try to reference
-- its datatype
create domain mytype as text;
create temp table foo (f1 text, f2 mytype, f3 text);
insert into foo values('aa','bb','cc');
select * from foo;
drop domain mytype cascade;
select * from foo;
insert into foo values('qq','rr');
select * from foo;
update foo set f3 = 'zz';
select * from foo;
select f3,max(f1) from foo group by f3;