diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index d10a983..cd10794 100644
*** a/src/backend/optimizer/plan/setrefs.c
--- b/src/backend/optimizer/plan/setrefs.c
*************** search_indexed_tlist_for_non_var(Node *n
*** 2010,2015 ****
--- 2010,2024 ----
  {
  	TargetEntry *tle;
  
+ 	/*
+ 	 * If it's a simple Const, replacing it with a Var is silly, even if there
+ 	 * happens to be an identical Const below.  What's more, doing so could
+ 	 * confuse some places in the executor that expect to see simple Consts
+ 	 * for, eg, dropped columns.
+ 	 */
+ 	if (IsA(node, Const))
+ 		return NULL;
+ 
  	tle = tlist_member(node, itlist->tlist);
  	if (tle)
  	{
