Apply fixes for problems with dropped columns whose types have also been
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/catalog/heap.c | modified | +40 −9 |
| src/backend/optimizer/plan/createplan.c | modified | +7 −1 |
| src/backend/optimizer/prep/preptlist.c | modified | +44 −14 |
| src/backend/optimizer/util/plancat.c | modified | +17 −3 |
| src/test/regress/expected/alter_table.out | modified | +41 −0 |
| src/test/regress/sql/alter_table.sql | modified | +18 −0 |