aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_clause.c
diff options
context:
space:
mode:
authorJan Wieck <JanWieck@Yahoo.com>1999-05-12 15:02:39 +0000
committerJan Wieck <JanWieck@Yahoo.com>1999-05-12 15:02:39 +0000
commit79c2576f775b962c67cac136722c5c7cc98201aa (patch)
tree3da66174208ed6b258542dde2ba9f00c0e706c07 /src/backend/parser/parse_clause.c
parent1a87c14c9cf2c58009dd653c5356f68d605dff2f (diff)
downloadpostgresql-79c2576f775b962c67cac136722c5c7cc98201aa.tar.gz
postgresql-79c2576f775b962c67cac136722c5c7cc98201aa.zip
Replaced targetlist entry in GroupClause by reference number
in Resdom and GroupClause so changing of resno's doesn't confuse the grouping any more. Jan
Diffstat (limited to 'src/backend/parser/parse_clause.c')
-rw-r--r--src/backend/parser/parse_clause.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 0085a4781b9..61359e3452a 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.29 1999/02/23 07:46:42 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_clause.c,v 1.30 1999/05/12 15:01:50 wieck Exp $
*
*-------------------------------------------------------------------------
*/
@@ -550,13 +550,19 @@ transformGroupClause(ParseState *pstate, List *grouplist, List *targetlist)
restarget = findTargetlistEntry(pstate, lfirst(grouplist), targetlist, GROUP_CLAUSE);
- grpcl->entry = restarget;
resdom = restarget->resdom;
grpcl->grpOpoid = oprid(oper("<",
resdom->restype,
resdom->restype, false));
if (glist == NIL)
+ {
+ int groupref = length(glist) + 1;
+
+ restarget->resdom->resgroupref = groupref;
+ grpcl->tleGroupref = groupref;
+
gl = glist = lcons(grpcl, NIL);
+ }
else
{
List *i;
@@ -565,11 +571,17 @@ transformGroupClause(ParseState *pstate, List *grouplist, List *targetlist)
{
GroupClause *gcl = (GroupClause *) lfirst(i);
- if (gcl->entry == grpcl->entry)
+ if (equal(get_groupclause_expr(gcl, targetlist),
+ restarget->expr))
break;
}
if (i == NIL) /* not in grouplist already */
{
+ int groupref = length(glist) + 1;
+
+ restarget->resdom->resgroupref = groupref;
+ grpcl->tleGroupref = groupref;
+
lnext(gl) = lcons(grpcl, NIL);
gl = lnext(gl);
}