Changeset: a534d20b6c00 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a534d20b6c00
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_scenario.c
sql/server/rel_dump.c
Branch: default
Log Message:
Merged with Oct2020
diffs (truncated from 763 to 300 lines):
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2178,11 +2178,11 @@ split_join_exps(sql_rel *rel, list *join
left_reference =
right_reference = 1;
}
} else {
- if (l->card != CARD_ATOM) {
+ if (l->card != CARD_ATOM ||
!exp_is_atom(l)) {
left_reference +=
rel_find_exp(rel->l, l) != NULL;
right_reference +=
rel_find_exp(rel->r, l) != NULL;
}
- if (r->card != CARD_ATOM) {
+ if (r->card != CARD_ATOM ||
!exp_is_atom(r)) {
left_reference +=
rel_find_exp(rel->l, r) != NULL;
right_reference +=
rel_find_exp(rel->r, r) != NULL;
}
@@ -2193,7 +2193,7 @@ split_join_exps(sql_rel *rel, list *join
for (node *n = l->h ; n ; n = n->next) {
sql_exp *ee = n->data;
- if (ee->card != CARD_ATOM) {
+ if (ee->card != CARD_ATOM ||
!exp_is_atom(ee)) {
left_reference +=
rel_find_exp(rel->l, ee) != NULL;
right_reference +=
rel_find_exp(rel->r, ee) != NULL;
}
@@ -2201,7 +2201,7 @@ split_join_exps(sql_rel *rel, list *join
for (node *n = r->h ; n ; n = n->next) {
sql_exp *ee = n->data;
- if (ee->card != CARD_ATOM) {
+ if (ee->card != CARD_ATOM ||
!exp_is_atom(ee)) {
left_reference +=
rel_find_exp(rel->l, ee) != NULL;
right_reference +=
rel_find_exp(rel->r, ee) != NULL;
}
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
@@ -337,6 +337,10 @@ SQLinit(Client c)
backend *be = NULL;
mvc *m = NULL;
sql_allocator *sa = NULL;
+ const char *opt_pipe;
+
+ if ((opt_pipe = GDKgetenv("sql_optimizer")) &&
!isOptimizerPipe(opt_pipe))
+ throw(SQL, "sql.init", SQLSTATE(42000) "invalid sql optimizer
pipeline %s", opt_pipe);
MT_lock_set(&sql_contextLock);
diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All
--- a/sql/jdbc/tests/Tests/All
+++ b/sql/jdbc/tests/Tests/All
@@ -46,3 +46,4 @@ HAVE_JDBCTESTS?Bug_PrepStmtSetString_638
HAVE_JDBCTESTS?Bug_LargeQueries_6571_6693
HAVE_JDBCTESTS?Bug_IsValid_Timeout_Bug_6782
HAVE_JDBCTESTS?Bug_PrepStmt_With_Errors_Jira292
+HAVE_JDBCCLIENT_JAR?ValidateSystemCatalogTables
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.bat
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.bat
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.bat
@@ -0,0 +1,11 @@
+@echo off
+
+echo user=monetdb> .monetdb
+echo password=monetdb>> .monetdb
+
+prompt # $t $g
+echo on
+
+call java nl.cwi.monetdb.client.JdbcClient -h %HOST% -p %MAPIPORT% -d %TSTDB%
-e -f "%TSTSRCBASE%\%TSTDIR%\Tests\ValidateSystemCatalogTables.sql"
+
+@del .monetdb
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.sh
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.sh
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.SQL.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cat << EOF > .monetdb
+user=monetdb
+password=monetdb
+EOF
+
+Mlog -x "java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d
${TSTDB} -e -f $TSTSRCBASE/$TSTDIR/Tests/ValidateSystemCatalogTables.sql"
+
+rm -f .monetdb
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.sql
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.sql
new file mode 100644
--- /dev/null
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.sql
@@ -0,0 +1,5 @@
+\vsci
+\vsi sys
+\vsi tmp
+\vdbi
+
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.err
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.err
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.err
@@ -0,0 +1,17 @@
+stderr of test 'ValidateSystemCatalogTables` in directory 'sql/jdbc/tests`
itself:
+
+
+# 16:25:51 >
+# 16:25:51 > "./ValidateSystemCatalogTables.SQL.sh"
"ValidateSystemCatalogTables"
+# 16:25:51 >
+
+
+# 16:25:51 >
+# 16:25:51 > java nl.cwi.monetdb.client.JdbcClient -h localhost -p 34154 -d
mTests_sql_jdbc_tests -e -f
/home/dinther/dev/dev/MonetDB/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.sql
+# 16:25:51 >
+
+
+# 16:25:55 >
+# 16:25:55 > "Done."
+# 16:25:55 >
+
diff --git a/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out
b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out
new file mode 100755
--- /dev/null
+++ b/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.stable.out
@@ -0,0 +1,45 @@
+stdout of test 'ValidateSystemCatalogTables` in directory 'sql/jdbc/tests`
itself:
+
+
+# 16:25:09 >
+# 16:25:09 > "./ValidateSystemCatalogTables.SQL.sh"
"ValidateSystemCatalogTables"
+# 16:25:09 >
+
+
+# 16:25:09 >
+# 16:25:09 > java nl.cwi.monetdb.client.JdbcClient -h localhost -p 34154 -d
mTests_sql_jdbc_tests -e -f
/home/dinther/dev/dev/MonetDB/sql/jdbc/tests/Tests/ValidateSystemCatalogTables.sql
+# 16:25:09 >
+
+\vsci
+Checking 45 tables/keys in schema sys for Primary Key uniqueness
violations.
+Checking 45 columns in schema sys for Primary Key Not Null violations.
+Checking 30 tables/keys in schema sys for Unique Constraint violations.
+Checking 96 foreign keys in schema sys for Foreign Key referential
integrity violations.
+Checking 169 columns in schema sys for Not Null violations.
+Checking 153 columns in schema sys for Max Character Length violations.
+Checking 6 tables/keys in schema tmp for Primary Key uniqueness
violations.
+Checking 6 columns in schema tmp for Primary Key Not Null violations.
+Checking 7 tables/keys in schema tmp for Unique Constraint violations.
+Checking 13 foreign keys in schema tmp for Foreign Key referential
integrity violations.
+Checking 35 columns in schema tmp for Not Null violations.
+Checking 14 columns in schema tmp for Max Character Length violations.
+\vsi sys
+Checking 10 keys in schema sys for Primary Key uniqueness
violations.
+Checking 7 keys in schema sys for Unique Constraint violations.
+Checking 0 foreign keys in schema sys for Foreign Key referential
integrity violations.
+Checking 29 columns in schema sys for Not Null violations.
+Checking 153 columns in schema sys for Max Character Length violations.
+\vsi tmp
+Checking 0 keys in schema tmp for Primary Key uniqueness
violations.
+Checking 0 keys in schema tmp for Unique Constraint violations.
+Checking 0 foreign keys in schema tmp for Foreign Key referential
integrity violations.
+Checking 0 columns in schema tmp for Not Null violations.
+Checking 14 columns in schema tmp for Max Character Length violations.
+\vdbi
+No user schemas found in this database.
+
+
+# 16:25:12 >
+# 16:25:12 > "Done."
+# 16:25:12 >
+
diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c
--- a/sql/server/rel_dump.c
+++ b/sql/server/rel_dump.c
@@ -745,7 +745,7 @@ readString( char *r, int *pos)
return st;
}
-static sql_exp* exp_read(mvc *sql, sql_rel *lrel, sql_rel *rrel, list *pexps,
char *r, int *pos, int grp) ;
+static sql_exp* exp_read(mvc *sql, sql_rel *lrel, sql_rel *rrel, list
*top_exps, char *r, int *pos, int grp) ;
static void *
read_prop( mvc *sql, sql_exp *exp, char *r, int *pos)
@@ -791,7 +791,7 @@ read_prop( mvc *sql, sql_exp *exp, char
}
static list*
-read_exps(mvc *sql, sql_rel *lrel, sql_rel *rrel, list *pexps, char *r, int
*pos, char bracket, int grp)
+read_exps(mvc *sql, sql_rel *lrel, sql_rel *rrel, list *top_exps, char *r, int
*pos, char bracket, int grp, int top)
{
list *exps = new_exp_list(sql->sa);
sql_exp *e;
@@ -802,7 +802,7 @@ read_exps(mvc *sql, sql_rel *lrel, sql_r
(*pos)++;
skipWS( r, pos);
- e = exp_read(sql, lrel, rrel, pexps, r, pos, grp);
+ e = exp_read(sql, lrel, rrel, top ? exps : top_exps, r, pos,
grp);
if (!e && r[*pos] != ebracket) {
return sql_error(sql, -1, SQLSTATE(42000) "Missing
closing %c\n", ebracket);
} else if (!e) {
@@ -815,21 +815,10 @@ read_exps(mvc *sql, sql_rel *lrel, sql_r
if (!read_prop(sql, e, r, pos))
return NULL;
while (r[*pos] == ',') {
- int op = 0;
(*pos)++;
skipWS( r, pos);
- op = *pos;
- e = exp_read(sql, lrel, rrel, exps, r, pos, grp);
- if (!e && pexps) {
- *pos = op;
- e = exp_read(sql, lrel, rrel, pexps, r, pos,
grp);
- if (e) {
- /* reset error */
- sql->session->status = 0;
- sql->errstr[0] = '\0';
- }
- }
+ e = exp_read(sql, lrel, rrel, top ? exps : top_exps, r,
pos, grp);
if (!e)
return NULL;
append(exps, e);
@@ -846,7 +835,7 @@ read_exps(mvc *sql, sql_rel *lrel, sql_r
}
static sql_exp*
-exp_read(mvc *sql, sql_rel *lrel, sql_rel *rrel, list *pexps, char *r, int
*pos, int grp)
+exp_read(mvc *sql, sql_rel *lrel, sql_rel *rrel, list *top_exps, char *r, int
*pos, int grp)
{
int f = -1, not = 1, old, d=0, s=0, unique = 0, no_nils = 0, quote = 0,
zero_if_empty = 0;
char *tname = NULL, *cname = NULL, *var_cname = NULL, *e, *b = r +
*pos, *st;
@@ -874,13 +863,10 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
cname = sa_strdup(sql->sa, cname);
*e = old;
skipWS(r, pos);
- if (pexps) {
- int mul = 0;
- exp = exps_bind_column2(pexps, tname, cname, &mul);
+ if (top_exps) {
+ exp = exps_bind_column2(top_exps, tname, cname, NULL);
if (exp)
exp = exp_alias_or_copy(sql, tname, cname,
lrel, exp);
- (void) mul;
- assert(mul == 0);
}
if (!exp && lrel) {
exp = rel_bind_column2(sql, lrel, tname, cname, 0);
@@ -897,7 +883,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
list *lexps,*rexps;
char *fname = NULL;
- if (!(lexps = read_exps(sql, lrel, rrel, pexps, r, pos,
'(', 0)))
+ if (!(lexps = read_exps(sql, lrel, rrel, top_exps, r,
pos, '(', 0, 0)))
return NULL;
skipWS(r, pos);
if (r[*pos] == '!') {
@@ -924,7 +910,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
skipWS(r,pos);
}
- if (!(rexps = read_exps(sql, lrel, rrel, pexps, r, pos,
'(', 0)))
+ if (!(rexps = read_exps(sql, lrel, rrel, top_exps, r,
pos, '(', 0, 0)))
return NULL;
if (filter) {
sql_subfunc *func = NULL;
@@ -951,7 +937,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
case '[':
tname = b;
if (tname && *tname == '[') { /* list of values */
- if (!(exps = read_exps(sql, lrel, rrel, pexps, r, pos,
'[', 0)))
+ if (!(exps = read_exps(sql, lrel, rrel, top_exps, r,
pos, '[', 0, 0)))
return NULL;
exp = exp_values(sql->sa, exps);
} else {
@@ -977,7 +963,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
if (r[*pos] == '[') { /* convert */
(*pos)++;
skipWS(r, pos);
- if (!(exp = exp_read(sql, lrel, rrel, pexps, r,
pos, 0)))
+ if (!(exp = exp_read(sql, lrel, rrel, top_exps,
r, pos, 0)))
return NULL;
if (r[*pos] != ']')
return sql_error(sql, -1,
SQLSTATE(42000) "Convert: missing ']'\n");
@@ -1035,7 +1021,7 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
sql_subfunc *a = NULL;
node *n;
- if (!(exps = read_exps(sql, lrel, rrel, pexps, r, pos, '(', 0)))
+ if (!(exps = read_exps(sql, lrel, rrel, top_exps, r, pos, '(',
0, 0)))
return NULL;
tname = b;
*e = 0;
@@ -1123,8 +1109,8 @@ exp_read(mvc *sql, sql_rel *lrel, sql_re
old = *e;
*e = 0;
var_cname = sa_strdup(sql->sa, b);
- if (pexps) {
- exp = exps_bind_column(pexps, var_cname, &amb,
&mul, 1);
+ if (top_exps) {
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list