Commit a039148c authored by Tom Lane's avatar Tom Lane

tlist_matches_tupdesc() needs to defend itself against dropped columns.

parent c63a5452
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.27 2003/08/08 21:41:40 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.28 2003/09/25 19:41:49 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -196,9 +196,7 @@ tlist_matches_tupdesc(List *tlist, Index varno, TupleDesc tupdesc) ...@@ -196,9 +196,7 @@ tlist_matches_tupdesc(List *tlist, Index varno, TupleDesc tupdesc)
for (attrno = 1; attrno <= numattrs; attrno++) for (attrno = 1; attrno <= numattrs; attrno++)
{ {
#ifdef USE_ASSERT_CHECKING /* only used in Assert() */
Form_pg_attribute att_tup = tupdesc->attrs[attrno - 1]; Form_pg_attribute att_tup = tupdesc->attrs[attrno - 1];
#endif
Var *var; Var *var;
if (tlist == NIL) if (tlist == NIL)
...@@ -207,11 +205,13 @@ tlist_matches_tupdesc(List *tlist, Index varno, TupleDesc tupdesc) ...@@ -207,11 +205,13 @@ tlist_matches_tupdesc(List *tlist, Index varno, TupleDesc tupdesc)
if (!var || !IsA(var, Var)) if (!var || !IsA(var, Var))
return false; /* tlist item not a Var */ return false; /* tlist item not a Var */
Assert(var->varno == varno); Assert(var->varno == varno);
Assert(var->varlevelsup == 0);
if (var->varattno != attrno) if (var->varattno != attrno)
return false; /* out of order */ return false; /* out of order */
if (att_tup->attisdropped)
return false; /* table contains dropped columns */
Assert(var->vartype == att_tup->atttypid); Assert(var->vartype == att_tup->atttypid);
Assert(var->vartypmod == att_tup->atttypmod); Assert(var->vartypmod == att_tup->atttypmod);
Assert(var->varlevelsup == 0);
tlist = lnext(tlist); tlist = lnext(tlist);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment