mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Revert previous change --- turns out the underlying problem affects
more cases than I thought, so ExecTypeFromTL() will have to be fixed anyway.
This commit is contained in:
		@@ -10,7 +10,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * IDENTIFICATION
 | 
					 * IDENTIFICATION
 | 
				
			||||||
 *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.140 2003/05/11 15:03:52 tgl Exp $
 | 
					 *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.141 2003/05/11 20:25:50 tgl Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *-------------------------------------------------------------------------
 | 
					 *-------------------------------------------------------------------------
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -295,12 +295,6 @@ use_physical_tlist(RelOptInfo *rel)
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	if (rel->reloptkind != RELOPT_BASEREL)
 | 
						if (rel->reloptkind != RELOPT_BASEREL)
 | 
				
			||||||
		return false;
 | 
							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
 | 
						 * 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,
 | 
						 * possibly be fixed but would take some fragile assumptions in setrefs.c,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,7 @@
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * IDENTIFICATION
 | 
					 * IDENTIFICATION
 | 
				
			||||||
 *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.80 2003/05/11 15:03:52 tgl Exp $
 | 
					 *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.81 2003/05/11 20:25:50 tgl Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *-------------------------------------------------------------------------
 | 
					 *-------------------------------------------------------------------------
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -62,15 +62,8 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
 | 
				
			|||||||
	relation = heap_open(relationObjectId, AccessShareLock);
 | 
						relation = heap_open(relationObjectId, AccessShareLock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * Make list of physical Vars.  But if there are any dropped columns,
 | 
						 * Make list of physical Vars.  Note we do NOT ignore dropped columns;
 | 
				
			||||||
	 * punt and set varlist to NIL.  (XXX Ideally we would like to include
 | 
						 * the intent is to model the physical tuples of the relation.
 | 
				
			||||||
	 * dropped columns so that the varlist models the physical tuples
 | 
					 | 
				
			||||||
	 * of the relation.  However this creates problems for ExecTypeFromTL,
 | 
					 | 
				
			||||||
	 * which may be asked to build a tupdesc for a tlist that includes vars
 | 
					 | 
				
			||||||
	 * of no-longer-existent types.  In theory we could dig out the required
 | 
					 | 
				
			||||||
	 * info from the pg_attribute entries of the relation, but that data is
 | 
					 | 
				
			||||||
	 * not readily available to ExecTypeFromTL.  For now, punt and don't
 | 
					 | 
				
			||||||
	 * apply the physical-tlist optimization when there are dropped cols.)
 | 
					 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	numattrs = RelationGetNumberOfAttributes(relation);
 | 
						numattrs = RelationGetNumberOfAttributes(relation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -78,13 +71,6 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel)
 | 
				
			|||||||
	{
 | 
						{
 | 
				
			||||||
		Form_pg_attribute att_tup = relation->rd_att->attrs[attrno - 1];
 | 
							Form_pg_attribute att_tup = relation->rd_att->attrs[attrno - 1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (att_tup->attisdropped)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			/* found a dropped col, so punt */
 | 
					 | 
				
			||||||
			varlist = NIL;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		varlist = lappend(varlist,
 | 
							varlist = lappend(varlist,
 | 
				
			||||||
						  makeVar(varno,
 | 
											  makeVar(varno,
 | 
				
			||||||
								  attrno,
 | 
													  attrno,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user