Changeset: dda55ac48ee9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dda55ac48ee9
Modified Files:
sql/backends/monet5/sql_statistics.c
sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.err
sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.out
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
Branch: Nov2019
Log Message:
Fix for bug 6817
diffs (178 lines):
diff --git a/sql/backends/monet5/sql_statistics.c
b/sql/backends/monet5/sql_statistics.c
--- a/sql/backends/monet5/sql_statistics.c
+++ b/sql/backends/monet5/sql_statistics.c
@@ -84,13 +84,13 @@ sql_analyze(Client cntxt, MalBlkPtr mb,
sys = mvc_bind_schema(m, "sys");
if (sys == NULL)
- throw(SQL, "sql.analyze", SQLSTATE(3F000) "Internal error");
+ throw(SQL, "sql.analyze", SQLSTATE(3F000) "Internal error: No
schema sys");
sysstats = mvc_bind_table(m, sys, "statistics");
if (sysstats == NULL)
- throw(SQL, "sql.analyze", SQLSTATE(3F000) "No table
sys.statistics");
+ throw(SQL, "sql.analyze", SQLSTATE(3F000) "Internal error: No
table sys.statistics");
statsid = mvc_bind_column(m, sysstats, "column_id");
if (statsid == NULL)
- throw(SQL, "sql.analyze", SQLSTATE(3F000) "No table
sys.statistics");
+ throw(SQL, "sql.analyze", SQLSTATE(3F000) "Internal error: No
table sys.statistics");
switch (argc) {
case 6:
@@ -121,12 +121,12 @@ sql_analyze(Client cntxt, MalBlkPtr mb,
if (tbl && strcmp(bt->name, tbl))
continue;
- if (t->persistence != SQL_PERSIST) {
+ tfnd = 1;
+ if (tbl && !isTable(t)) {
GDKfree(maxval);
GDKfree(minval);
- throw(SQL, "analyze", SQLSTATE(42S02)
"Table '%s' is not persistent", bt->name);
+ throw(SQL, "analyze", SQLSTATE(42S02)
"%s '%s' is not persistent", TABLE_TYPE_DESCRIPTION(t->type, t->properties),
bt->name);
}
- tfnd = 1;
if (isTable(t) && t->columns.set)
for (ncol = (t)->columns.set->h; ncol;
ncol = ncol->next) {
sql_base *bc = ncol->data;
diff --git
a/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.err
b/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.err
---
a/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.err
+++
b/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.err
@@ -29,10 +29,6 @@ stderr of test 'statistics_nils_not_eq_z
# 13:40:16 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-25363" "--port=30826"
# 13:40:16 >
-MAPI = (monetdb) /var/tmp/mtest-4063/.s.monetdb.31696
-QUERY = ANALYZE tmp;
-ERROR = !Table '_tables' is not persistent
-CODE = 42S02
# 13:40:17 >
# 13:40:17 > "Done."
diff --git
a/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.out
b/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.out
---
a/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.out
+++
b/sql/test/BugTracker-2017/Tests/statistics_nils_not_eq_zero.Bug-6331.stable.out
@@ -66,62 +66,62 @@ stdout of test 'statistics_nils_not_eq_z
# 13:40:16 >
#SELECT count(*) = 0 FROM sys.statistics;
-% .L4 # table_name
-% L4 # name
+% .L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0;
-% sys.L4 # table_name
-% L4 # name
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
-#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0 AND (minval = 'nil'
OR maxval = 'nil');
-% sys.L4 # table_name
-% L4 # name
+#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0 AND (minval IS NULL
OR maxval IS NULL);
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
-#SELECT count(*) > 0 FROM sys.statistics WHERE count > 0 AND (minval = 'nil'
OR maxval = 'nil');
-% sys.L4 # table_name
-% L4 # name
+#SELECT count(*) > 0 FROM sys.statistics WHERE count > 0 AND (minval IS NULL
OR maxval IS NULL);
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0;
-% sys.L4 # table_name
-% L4 # name
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
-#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0 AND (minval = 'nil'
OR maxval = 'nil');
-% sys.L4 # table_name
-% L4 # name
+#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0 AND (minval IS NULL
OR maxval IS NULL);
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
-#SELECT count(*) > 0 FROM sys.statistics WHERE count > 0 AND (minval = 'nil'
OR maxval = 'nil');
-% sys.L4 # table_name
-% L4 # name
+#SELECT count(*) > 0 FROM sys.statistics WHERE count > 0 AND (minval IS NULL
OR maxval IS NULL);
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0;
-% sys.L4 # table_name
-% L4 # name
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
-#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0 AND (minval = 'nil'
OR maxval = 'nil');
-% sys.L4 # table_name
-% L4 # name
+#SELECT count(*) > 0 FROM sys.statistics WHERE nils <> 0 AND (minval IS NULL
OR maxval IS NULL);
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
-#SELECT count(*) > 0 FROM sys.statistics WHERE count > 0 AND (minval = 'nil'
OR maxval = 'nil');
-% sys.L4 # table_name
-% L4 # name
+#SELECT count(*) > 0 FROM sys.statistics WHERE count > 0 AND (minval IS NULL
OR maxval IS NULL);
+% sys.L3 # table_name
+% L3 # name
% boolean # type
% 5 # length
[ true ]
@@ -132,7 +132,7 @@ stdout of test 'statistics_nils_not_eq_z
% 21 # length
[ "~BeginVariableOutput~" ]
#DELETE FROM sys.statistics;
-[ 196 ]
+[ 237 ]
#select '~EndVariableOutput~';
% .L2 # table_name
% L2 # name
diff --git a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
--- a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
+++ b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.sql
@@ -13,8 +13,7 @@ analyze "sys"."strt";
-- Error: Table 'strt' is not persistent SQLState: 42S02
select (count(*) > 0) as has_rows from statistics;
-analyze sys;
--- Error: Table 'strt' is not persistent SQLState: 42S02
+analyze sys; --not an error, skip stream table "strt"
select (count(*) > 0) as has_rows from statistics;
drop table "sys"."strt";
diff --git
a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
--- a/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
+++ b/sql/test/BugTracker-2020/Tests/analyze-stream-table.Bug-6817.stable.err
@@ -25,6 +25,10 @@ stderr of test 'analyze-stream-table.Bug
# 13:50:18 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-891865" "--port=35996"
# 13:50:18 >
+MAPI = (monetdb) /var/tmp/mtest-161340/.s.monetdb.34379
+QUERY = analyze "sys"."strt";
+ERROR = !STREAM TABLE 'strt' is not persistent
+CODE = 42S02
# 13:50:18 >
# 13:50:18 > "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list