Changeset: d318a5973f0c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d318a5973f0c
Added Files:
sql/test/BugTracker-2019/Tests/orderby-alias-expr.Bug-6799.sql
sql/test/BugTracker-2019/Tests/orderby-alias-expr.Bug-6799.stable.err
sql/test/BugTracker-2019/Tests/orderby-alias-expr.Bug-6799.stable.out
sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Bug-6761.sql
sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Bug-6761.stable.err
sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Bug-6761.stable.out
Modified Files:
sql/backends/monet5/sql_scenario.c
sql/test/BugTracker-2019/Tests/All
sql/test/BugTracker-2019/Tests/date_trunc.sql
sql/test/BugTracker-2019/Tests/date_trunc.stable.out
sql/test/BugTracker-2019/Tests/date_trunc_bulk.sql
sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
Branch: default
Log Message:
Merge with Nov2019
diffs (truncated from 552 to 300 lines):
diff --git a/sql/backends/monet5/sql_scenario.c
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -1390,32 +1390,38 @@ SQLCacheRemove(Client c, str nme)
str
SQLcallback(Client c, str msg)
{
- char *newerr;
+ char *newerr = NULL;
- if (msg &&
- (newerr = GDKmalloc(strlen(msg) + 1)) != NULL) {
- /* remove exception decoration */
- char *m, *n, *p, *s;
- size_t l;
+ if (msg) {
+ if (!(newerr = GDKmalloc(strlen(msg) + 1))) {
+ msg = createException(SQL, "SQLcallback",
SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ } else {
+ /* remove exception decoration */
+ char *m, *n, *p, *s;
+ size_t l;
- m = msg;
- p = newerr;
- while (m && *m) {
- n = strchr(m, '\n');
- s = getExceptionMessageAndState(m);
- if (n) {
- n++; /* include newline */
- l = n - s;
- } else {
- l = strlen(s);
+ m = msg;
+ p = newerr;
+ while (m && *m) {
+ n = strchr(m, '\n');
+ s = getExceptionMessageAndState(m);
+ if (n) {
+ n++; /* include newline */
+ l = n - s;
+ } else {
+ l = strlen(s);
+ }
+ memcpy(p, s, l);
+ p += l;
+ m = n;
}
- memcpy(p, s, l);
- p += l;
- m = n;
+ *p = 0;
+ freeException(msg);
+ if (!(msg = GDKrealloc(newerr, strlen(newerr) + 1))) {
+ GDKfree(newerr);
+ msg = createException(SQL, "SQLcallback",
SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ }
}
- *p = 0;
- freeException(msg);
- msg = GDKrealloc(newerr, strlen(newerr) + 1);
}
return MALcallback(c, msg);
}
diff --git a/sql/test/BugTracker-2019/Tests/All
b/sql/test/BugTracker-2019/Tests/All
--- a/sql/test/BugTracker-2019/Tests/All
+++ b/sql/test/BugTracker-2019/Tests/All
@@ -37,11 +37,11 @@ merge-table-limit.Bug-6756
double-free.Bug-6757
HAVE_LIBPY3?python-loader-string.Bug-6759
select-char.Bug-6761
+prepared-select-with-error-causes-hang.Bug-6761
grant-select-column.Bug-6765
next-get-value-bulk.Bug-6766
filter_json_null.Bug-6773
prod-decimals.Bug-6774
-prepared-select-with-error-causes-hang.Jira-292
NOT_IN-AND-OR-wrong-results.Bug-6775
outer-join-varchar.Bug-6776
msqldump-mapi-cache.Bug-6777
@@ -56,3 +56,4 @@ cast-interval.Bug-6793
could-not-allocate-space.Bug-6795
HAVE_LIBPY3?python3-udf-modules.Bug-6797
json-text-empty-separator.Bug-6798
+orderby-alias-expr.Bug-6799
diff --git a/sql/test/BugTracker-2019/Tests/date_trunc.sql
b/sql/test/BugTracker-2019/Tests/date_trunc.sql
--- a/sql/test/BugTracker-2019/Tests/date_trunc.sql
+++ b/sql/test/BugTracker-2019/Tests/date_trunc.sql
@@ -14,3 +14,20 @@ select date_trunc('year', timestamp '211
select date_trunc('decade', timestamp '2119-02-17 02:08:12.345678');
select date_trunc('century', timestamp '2119-02-17 02:08:12.345678');
select date_trunc('millennium', timestamp '2119-02-17 02:08:12.345678');
+
+select timestamp '1999-12-31 23:59:59.987654';
+
+select date_trunc('microseconds', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('milliseconds', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('second', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('minute', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('hour', timestamp '1999-12-31 23:59:59.987654');
+
+select date_trunc('day', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('week', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('month', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('quarter', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('year', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('decade', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('century', timestamp '1999-12-31 23:59:59.987654');
+select date_trunc('millennium', timestamp '1999-12-31 23:59:59.987654');
diff --git a/sql/test/BugTracker-2019/Tests/date_trunc.stable.out
b/sql/test/BugTracker-2019/Tests/date_trunc.stable.out
--- a/sql/test/BugTracker-2019/Tests/date_trunc.stable.out
+++ b/sql/test/BugTracker-2019/Tests/date_trunc.stable.out
@@ -103,6 +103,90 @@ stdout of test 'date_trunc` in directory
% timestamp # type
% 26 # length
[ 2000-01-01 00:00:00.000000 ]
+#select timestamp '1999-12-31 23:59:59.987654';
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-31 23:59:59.987654 ]
+#select date_trunc('microseconds', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-31 23:59:59.987654 ]
+#select date_trunc('milliseconds', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-31 23:59:59.987000 ]
+#select date_trunc('second', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-31 23:59:59.000000 ]
+#select date_trunc('minute', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-31 23:59:00.000000 ]
+#select date_trunc('hour', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-31 23:36:00.000000 ]
+#select date_trunc('day', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-31 00:00:00.000000 ]
+#select date_trunc('week', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-27 00:00:00.000000 ]
+#select date_trunc('month', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-12-01 00:00:00.000000 ]
+#select date_trunc('quarter', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-04-01 00:00:00.000000 ]
+#select date_trunc('year', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1999-01-01 00:00:00.000000 ]
+#select date_trunc('decade', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1990-01-01 00:00:00.000000 ]
+#select date_trunc('century', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1900-01-01 00:00:00.000000 ]
+#select date_trunc('millennium', timestamp '1999-12-31 23:59:59.987654');
+% . # table_name
+% %1 # name
+% timestamp # type
+% 26 # length
+[ 1000-01-01 00:00:00.000000 ]
# 08:07:24 >
# 08:07:24 > "Done."
diff --git a/sql/test/BugTracker-2019/Tests/date_trunc_bulk.sql
b/sql/test/BugTracker-2019/Tests/date_trunc_bulk.sql
--- a/sql/test/BugTracker-2019/Tests/date_trunc_bulk.sql
+++ b/sql/test/BugTracker-2019/Tests/date_trunc_bulk.sql
@@ -1,6 +1,7 @@
start transaction;
create table dt_tmp( t timestamp);
insert into dt_tmp values (timestamp '2119-02-17 02:08:12.345678'), (null);
+insert into dt_tmp values (timestamp '1999-12-31 23:59:59.987654');
select * from dt_tmp;
diff --git a/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
b/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
--- a/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
+++ b/sql/test/BugTracker-2019/Tests/date_trunc_bulk.stable.out
@@ -27,6 +27,8 @@ stdout of test 'date_trunc_bulk` in dire
#create table dt_tmp( t timestamp);
#insert into dt_tmp values (timestamp '2119-02-17 02:08:12.345678'), (null);
[ 2 ]
+#insert into dt_tmp values (timestamp '1999-12-31 23:59:59.987654');
+[ 1 ]
#select * from dt_tmp;
% sys.dt_tmp # table_name
% t # name
@@ -34,6 +36,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-17 02:08:12.345678 ]
[ NULL ]
+[ 1999-12-31 23:59:59.987654 ]
#select date_trunc('microseconds', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -41,6 +44,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-17 02:08:12.345678 ]
[ NULL ]
+[ 1999-12-31 23:59:59.987654 ]
#select date_trunc('milliseconds', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -48,6 +52,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-17 02:08:12.345000 ]
[ NULL ]
+[ 1999-12-31 23:59:59.987000 ]
#select date_trunc('second', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -55,6 +60,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-17 02:08:12.000000 ]
[ NULL ]
+[ 1999-12-31 23:59:59.000000 ]
#select date_trunc('minute', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -62,6 +68,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-17 02:08:00.000000 ]
[ NULL ]
+[ 1999-12-31 23:59:00.000000 ]
#select date_trunc('hour', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -69,6 +76,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-17 02:00:00.000000 ]
[ NULL ]
+[ 1999-12-31 23:36:00.000000 ]
#select date_trunc('day', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -76,6 +84,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-17 00:00:00.000000 ]
[ NULL ]
+[ 1999-12-31 00:00:00.000000 ]
#select date_trunc('week', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -83,6 +92,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-13 00:00:00.000000 ]
[ NULL ]
+[ 1999-12-27 00:00:00.000000 ]
#select date_trunc('month', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -90,6 +100,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
[ 2119-02-01 00:00:00.000000 ]
[ NULL ]
+[ 1999-12-01 00:00:00.000000 ]
#select date_trunc('quarter', t) from dt_tmp;
% . # table_name
% %1 # name
@@ -97,6 +108,7 @@ stdout of test 'date_trunc_bulk` in dire
% 26 # length
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list