Update of /cvsroot/monetdb/pathfinder/compiler/sql
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv28780/sql

Modified Files:
        lalg2sql.brg 
Log Message:
-- In the SQL code generation remove duplicate entries from the group by list.


U lalg2sql.brg
Index: lalg2sql.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/sql/lalg2sql.brg,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- lalg2sql.brg        16 Jun 2009 13:58:52 -0000      1.163
+++ lalg2sql.brg        16 Jun 2009 14:38:43 -0000      1.164
@@ -4057,9 +4057,23 @@
                 /* generate the aggregation */
                 switch (p->sem.aggr.aggr[i].kind) {
                     case alg_aggr_dist:
-                        /* extend group by list */
-                        groupbylist = column_list (groupbylist, expr);
-                        break;
+                    {
+                        PFsql_t *collist = groupbylist;
+                        /* Try to find the expression @a expr
+                           in the column list. */
+                        while (collist) {
+                            if (R(collist) == expr)
+                                break;
+                            else
+                                collist = L(collist);
+                        }
+                        /* In case the expression did not exist in
+                           the column list already ... */
+                        if (!collist)
+                            /* ... extend the group by list. */
+                            groupbylist = column_list (groupbylist, expr);
+                    }   break;
+
                     case alg_aggr_min:   expr = min_ (expr);     break;
                     case alg_aggr_max:   expr = max_ (expr);     break;
                     case alg_aggr_all: 


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to