From a873da484fdc32aa91b6ba3cbad173111699fe59 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Wed, 26 Aug 1998 03:17:32 +0000
Subject: [PATCH] Fix for select bug.

---
 src/backend/parser/parse_target.c | 42 ++++++++++++++++---------------
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 50b94a23a48..bf73ef452bd 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.24 1998/08/25 03:22:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.25 1998/08/26 03:17:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -575,28 +575,30 @@ printf("transformTargetList: decode T_Ident\n");
 							lnext(tail_p_target) = ExpandAllTables(pstate);
 						expand_star = true;
 					}
-
-					/*
-					 * Target item is relation.*, expand the table (eg.
-					 * SELECT emp.*, dname FROM emp, dept)
-					 */
-					attrname = strVal(lfirst(att->attrs));
-					if (att->attrs != NIL && !strcmp(attrname, "*"))
+					else
 					{
-
 						/*
-						 * tail_p_target is the target list we're building
-						 * in the while loop. Make sure we fix it after
-						 * appending more nodes.
+						 * Target item is relation.*, expand the table (eg.
+						 * SELECT emp.*, dname FROM emp, dept)
 						 */
-						if (tail_p_target == NIL)
-							p_target = tail_p_target = expandAll(pstate, att->relname,
-									att->relname, &pstate->p_last_resno);
-						else
-							lnext(tail_p_target) =
-								expandAll(pstate, att->relname, att->relname,
-										  &pstate->p_last_resno);
-						expand_star = true;
+						attrname = strVal(lfirst(att->attrs));
+						if (att->attrs != NIL && !strcmp(attrname, "*"))
+						{
+	
+							/*
+							 * tail_p_target is the target list we're building
+							 * in the while loop. Make sure we fix it after
+							 * appending more nodes.
+							 */
+							if (tail_p_target == NIL)
+								p_target = tail_p_target = expandAll(pstate, att->relname,
+										att->relname, &pstate->p_last_resno);
+							else
+								lnext(tail_p_target) =
+									expandAll(pstate, att->relname, att->relname,
+											  &pstate->p_last_resno);
+							expand_star = true;
+						}
 					}
 					if (expand_star)
 					{
-- 
GitLab