Changeset: 859e55bc7ea6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=859e55bc7ea6
Modified Files:
        sql/server/rel_select.c
        sql/test/SQLancer/Tests/sqlancer03.sql
        sql/test/SQLancer/Tests/sqlancer03.stable.out
Branch: Jun2020
Log Message:

Small bugfix, functions with no parameters have atom cardinality, so no check 
needed in aggregations


diffs (53 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -2787,14 +2787,6 @@ rel_op(sql_query *query, sql_rel **rel, 
                return sql_error(sql, 02, SQLSTATE(3F000) "SELECT: no such 
schema '%s'", sname);
 
        sf = find_func(sql, s, fname, 0, F_AGGR, NULL);
-       if (!sf && *rel && (*rel)->card == CARD_AGGR) {
-               if (is_sql_having(f) || is_sql_orderby(f))
-                       return NULL;
-               /* reset error */
-               sql->session->status = 0;
-               sql->errstr[0] = '\0';
-               return sql_error(sql, 02, SQLSTATE(42000) "SELECT: no such 
aggregate '%s'", fname);
-       }
        if (sf)
                return _rel_aggr(query, rel, 0, s, fname, NULL, f);
        return rel_op_(sql, s, fname, ek);
diff --git a/sql/test/SQLancer/Tests/sqlancer03.sql 
b/sql/test/SQLancer/Tests/sqlancer03.sql
--- a/sql/test/SQLancer/Tests/sqlancer03.sql
+++ b/sql/test/SQLancer/Tests/sqlancer03.sql
@@ -142,3 +142,9 @@ COPY 1 RECORDS INTO "sys"."t0" FROM stdi
 
 select t0.c0 from t0 where not (true) union all select all t0.c0 from t0 where 
not (not (true)) union all select t0.c0 from t0 where (not (true)) is null;
 ROLLBACK;
+
+START TRANSACTION;
+create table t0 (a int, b int);
+insert into t0 values (1,1), (2,2);
+select min(t0.a), pi() from t0 group by t0.b;
+ROLLBACK;
diff --git a/sql/test/SQLancer/Tests/sqlancer03.stable.out 
b/sql/test/SQLancer/Tests/sqlancer03.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer03.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer03.stable.out
@@ -231,6 +231,18 @@ stdout of test 'sqlancer03` in directory
 % 20 # length
 [ -1933820187.000      ]
 #ROLLBACK;
+#START TRANSACTION;
+#create table t0 (a int, b int);
+#insert into t0 values (1,1), (2,2);
+[ 2    ]
+#select min(t0.a), pi() from t0 group by t0.b;
+% sys.%1,      .%2 # table_name
+% %1,  %2 # name
+% int, double # type
+% 1,   24 # length
+[ 1,   3.141592654     ]
+[ 2,   3.141592654     ]
+#ROLLBACK;
 
 # 17:14:16 >  
 # 17:14:16 >  "Done."
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to