Re: intermittent error: 'variable not found in subplan target list'

Started by Tom Laneabout 22 years ago1 messagesbugs
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

Damon Hart <dhcom@sundial.com> writes:

Thanks for your response, the full original post follows, including both
scripts.

Found it. The patch for 7.4.* is attached. It will appear in 7.4.2.

regards, tom lane

Index: src/backend/optimizer/plan/initsplan.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/optimizer/plan/initsplan.c,v
retrieving revision 1.91.2.1
diff -c -r1.91.2.1 initsplan.c
*** src/backend/optimizer/plan/initsplan.c	5 Nov 2003 22:00:52 -0000	1.91.2.1
--- src/backend/optimizer/plan/initsplan.c	27 Feb 2004 21:38:40 -0000
***************
*** 768,778 ****
  				 errmsg("equality operator for types %s and %s should be merge-joinable, but isn't",
  						format_type_be(ltype), format_type_be(rtype))));

clause = make_opclause(oprid(eq_operator), /* opno */
BOOLOID, /* opresulttype */
false, /* opretset */
! (Expr *) item1,
! (Expr *) item2);

ReleaseSysCache(eq_operator);

--- 768,783 ----
  				 errmsg("equality operator for types %s and %s should be merge-joinable, but isn't",
  						format_type_be(ltype), format_type_be(rtype))));
+ 	/*
+ 	 * Now we can build the new clause.  Copy to ensure it shares no
+ 	 * substructure with original (this is necessary in case there are
+ 	 * subselects in there...)
+ 	 */
  	clause = make_opclause(oprid(eq_operator),	/* opno */
  						   BOOLOID,		/* opresulttype */
  						   false,		/* opretset */
! 						   (Expr *) copyObject(item1),
! 						   (Expr *) copyObject(item2));

ReleaseSysCache(eq_operator);