From 79f99a3888ab3e6a934da47b36d912f9723e1415 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sun, 1 Feb 1998 22:20:47 +0000
Subject: [PATCH] Fix for psort. fixes regression tests.

---
 src/backend/parser/parse_expr.c | 6 +++---
 src/backend/utils/sort/psort.c  | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index e4f0eace9ec..3a3242f4d09 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.13 1998/02/01 19:43:37 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.14 1998/02/01 22:20:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -252,14 +252,14 @@ transformExpr(ParseState *pstate, Node *expr, int precedence)
 					lfirst(llist) = transformExpr(pstate, lfirst(llist), precedence);
 			
 				if (length(sublink->lefthand) !=
-					length(sublink->subselect->targetList))
+					length(((Query *)sublink->subselect)->targetList))
 					elog(ERROR,"Subselect has too many or too few fields.");
 					
 				if (sublink->subLinkType != EXISTS_SUBLINK)
 				{
 					char *op = lfirst(sublink->oper);
 					List *left_expr = sublink->lefthand;
-					List *right_expr = sublink->subselect->targetList;
+					List *right_expr = ((Query *)sublink->subselect)->targetList;
 					List *elist;
 
 					sublink->oper = NIL;
diff --git a/src/backend/utils/sort/psort.c b/src/backend/utils/sort/psort.c
index c30e13e0463..4fa99d09e50 100644
--- a/src/backend/utils/sort/psort.c
+++ b/src/backend/utils/sort/psort.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.35 1998/01/31 04:39:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.36 1998/02/01 22:20:47 momjian Exp $
  *
  * NOTES
  *		Sorts the first relation into the second relation.
@@ -1090,7 +1090,7 @@ static int
 _psort_cmp (HeapTuple *ltup, HeapTuple *rtup)
 {
     register Datum	lattr, rattr;
-    int		nkey = 0;
+    int		nkey;
     int		result = 0;
     bool	isnull1, isnull2;
     
@@ -1119,7 +1119,6 @@ _psort_cmp (HeapTuple *ltup, HeapTuple *rtup)
 		}
 		else if (!(result = -(long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (lattr, rattr)))
 		    result = (long) (*fmgr_faddr(&PsortKeys[nkey].sk_func)) (rattr, lattr);
-		nkey++;
     }
     return (result);
 }
-- 
GitLab