From d97c9b366273a49f0469184df9dfb3a312b2f3ff Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 12 May 2003 00:17:03 +0000 Subject: 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. --- src/backend/optimizer/plan/createplan.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/backend/optimizer/plan/createplan.c') diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index e9dd994cd21..f50eb792811 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.141 2003/05/11 20:25:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.142 2003/05/12 00:17:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -295,6 +295,12 @@ use_physical_tlist(RelOptInfo *rel) */ if (rel->reloptkind != RELOPT_BASEREL) return false; + /* + * Can't do it if relation contains dropped columns. This is detected + * in plancat.c, see notes there. + */ + if (rel->varlist == NIL) + return false; /* * Can't do it if any system columns are requested, either. (This could * possibly be fixed but would take some fragile assumptions in setrefs.c, -- cgit v1.2.3