mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	ExecSubPlan needs to be able to cope with RelabelType nodes atop the
Const placeholder nodes for subplan result values.
This commit is contained in:
		@@ -7,7 +7,7 @@
 | 
				
			|||||||
 * Portions Copyright (c) 1994, Regents of the University of California
 | 
					 * Portions Copyright (c) 1994, Regents of the University of California
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * IDENTIFICATION
 | 
					 * IDENTIFICATION
 | 
				
			||||||
 *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.23 2000/03/21 04:20:45 tgl Exp $
 | 
					 *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.24 2000/03/23 07:32:58 tgl Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 *-------------------------------------------------------------------------
 | 
					 *-------------------------------------------------------------------------
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@@ -141,16 +141,28 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * The righthand side of the expression should be either a Const
 | 
								 * The righthand side of the expression should be either a Const
 | 
				
			||||||
			 * or a function call taking a Const as arg (the function would
 | 
								 * or a function call or RelabelType node taking a Const as arg
 | 
				
			||||||
			 * be a run-time type coercion inserted by the parser to get to
 | 
								 * (these nodes represent run-time type coercions inserted by
 | 
				
			||||||
			 * the input type needed by the operator).  Find the Const node
 | 
								 * the parser to get to the input type needed by the operator).
 | 
				
			||||||
			 * and insert the actual righthand side value into it.
 | 
								 * Find the Const node and insert the actual righthand-side value
 | 
				
			||||||
 | 
								 * into it.
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			if (! IsA(con, Const))
 | 
								if (! IsA(con, Const))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				Assert(IsA(con, Expr));
 | 
									switch (con->type)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										case T_Expr:
 | 
				
			||||||
						con = lfirst(((Expr *) con)->args);
 | 
											con = lfirst(((Expr *) con)->args);
 | 
				
			||||||
				Assert(IsA(con, Const));
 | 
											break;
 | 
				
			||||||
 | 
										case T_RelabelType:
 | 
				
			||||||
 | 
											con = (Const *) (((RelabelType *) con)->arg);
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
										default:
 | 
				
			||||||
 | 
											/* will fail below */
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									if (! IsA(con, Const))
 | 
				
			||||||
 | 
										elog(ERROR, "ExecSubPlan: failed to find placeholder for subplan result");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			con->constvalue = heap_getattr(tup, col, tdesc,
 | 
								con->constvalue = heap_getattr(tup, col, tdesc,
 | 
				
			||||||
										   &(con->constisnull));
 | 
															   &(con->constisnull));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user