Skip to content

Commit a039148

Browse files
committed
tlist_matches_tupdesc() needs to defend itself against dropped columns.
1 parent c63a545 commit a039148

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/executor/execScan.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.27 2003/08/08 21:41:40 momjian Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.28 2003/09/25 19:41:49 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -196,9 +196,7 @@ tlist_matches_tupdesc(List *tlist, Index varno, TupleDesc tupdesc)
196196

197197
for (attrno = 1; attrno <= numattrs; attrno++)
198198
{
199-
#ifdef USE_ASSERT_CHECKING /* only used in Assert() */
200199
Form_pg_attribute att_tup = tupdesc->attrs[attrno - 1];
201-
#endif
202200
Var *var;
203201

204202
if (tlist == NIL)
@@ -207,11 +205,13 @@ tlist_matches_tupdesc(List *tlist, Index varno, TupleDesc tupdesc)
207205
if (!var || !IsA(var, Var))
208206
return false; /* tlist item not a Var */
209207
Assert(var->varno == varno);
208+
Assert(var->varlevelsup == 0);
210209
if (var->varattno != attrno)
211210
return false; /* out of order */
211+
if (att_tup->attisdropped)
212+
return false; /* table contains dropped columns */
212213
Assert(var->vartype == att_tup->atttypid);
213214
Assert(var->vartypmod == att_tup->atttypmod);
214-
Assert(var->varlevelsup == 0);
215215

216216
tlist = lnext(tlist);
217217
}

0 commit comments

Comments
 (0)