diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c
index 6764b3af678f1205158579370cd20991346e56c7..07a08f3f6699ebfc7e4e4226ddcfeb75831b3486 100644
--- a/src/backend/executor/execScan.c
+++ b/src/backend/executor/execScan.c
@@ -12,7 +12,7 @@
  *
  *
  * 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)
 
 	for (attrno = 1; attrno <= numattrs; attrno++)
 	{
-#ifdef USE_ASSERT_CHECKING		/* only used in Assert() */
 		Form_pg_attribute att_tup = tupdesc->attrs[attrno - 1];
-#endif
 		Var		   *var;
 
 		if (tlist == NIL)
@@ -207,11 +205,13 @@ tlist_matches_tupdesc(List *tlist, Index varno, TupleDesc tupdesc)
 		if (!var || !IsA(var, Var))
 			return false;		/* tlist item not a Var */
 		Assert(var->varno == varno);
+		Assert(var->varlevelsup == 0);
 		if (var->varattno != attrno)
 			return false;		/* out of order */
+		if (att_tup->attisdropped)
+			return false;		/* table contains dropped columns */
 		Assert(var->vartype == att_tup->atttypid);
 		Assert(var->vartypmod == att_tup->atttypmod);
-		Assert(var->varlevelsup == 0);
 
 		tlist = lnext(tlist);
 	}