Fix for select bug.

This commit is contained in:
Bruce Momjian 1998-08-26 03:17:32 +00:00
parent 96c4212f99
commit a873da484f

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); lnext(tail_p_target) = ExpandAllTables(pstate);
expand_star = true; expand_star = true;
} }
else
/*
* 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, "*"))
{ {
/* /*
* tail_p_target is the target list we're building * Target item is relation.*, expand the table (eg.
* in the while loop. Make sure we fix it after * SELECT emp.*, dname FROM emp, dept)
* appending more nodes.
*/ */
if (tail_p_target == NIL) attrname = strVal(lfirst(att->attrs));
p_target = tail_p_target = expandAll(pstate, att->relname, if (att->attrs != NIL && !strcmp(attrname, "*"))
att->relname, &pstate->p_last_resno); {
else
lnext(tail_p_target) = /*
expandAll(pstate, att->relname, att->relname, * tail_p_target is the target list we're building
&pstate->p_last_resno); * in the while loop. Make sure we fix it after
expand_star = true; * 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) if (expand_star)
{ {