Changeset: a207071d3ec8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a207071d3ec8
Modified Files:
sql/server/rel_dump.c
Branch: default
Log Message:
merged with aug2024
diffs (78 lines):
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
@@ -2555,21 +2555,25 @@ exp2sql_dquoted(stream *fout, const char
/* only simple expressions, ie recursive no psm */
static void
-exp2sql_print(mvc *sql, stream *fout, sql_exp *e)
+exp2sql_print(mvc *sql, stream *fout, sql_exp *e, int depth)
{
switch (e->type) {
case e_func: {
sql_subfunc *sf = e->f;
list *args = e->l;
if (list_length(args) == 2 && is_infix(sf->func)) {
- exp2sql_print(sql, fout, args->h->data);
+ if (depth)
+ mnstr_printf(fout, "( " );
+ exp2sql_print(sql, fout, args->h->data,
depth+1);
mnstr_printf(fout, " %s ", sf->func->base.name);
- exp2sql_print(sql, fout, args->h->next->data);
+ exp2sql_print(sql, fout, args->h->next->data,
depth+1);
+ if (depth)
+ mnstr_printf(fout, " )" );
} else {
exp2sql_dquoted(fout, NULL,
sf->func->base.name, "(");
if (args)
for (node *n = args->h; n; n = n->next)
{
- exp2sql_print(sql, fout,
n->data);
+ exp2sql_print(sql, fout,
n->data, depth+1);
if (n->next)
mnstr_printf(fout, ",
");
}
@@ -2581,7 +2585,7 @@ exp2sql_print(mvc *sql, stream *fout, sq
break;
case e_convert:
mnstr_printf(fout, "CAST (" );
- exp2sql_print(sql, fout, e->l);
+ exp2sql_print(sql, fout, e->l, depth+1);
mnstr_printf(fout, "AS %s)",
sql_subtype_string(sql->sa, exp_subtype(e)));
break;
case e_atom:
@@ -2609,7 +2613,7 @@ exp2sql( mvc *sql, sql_exp *exp)
if(s == NULL)
goto cleanup;
- exp2sql_print(sql, s, exp);
+ exp2sql_print(sql, s, exp, 0);
res = buffer_get_buf(b);
diff --git a/sql/test/subquery/Tests/subquery3.test
b/sql/test/subquery/Tests/subquery3.test
--- a/sql/test/subquery/Tests/subquery3.test
+++ b/sql/test/subquery/Tests/subquery3.test
@@ -624,19 +624,19 @@ query I rowsort
SELECT col1 FROM another_T WHERE (col2, col3) IN (SELECT 1,2)
----
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '('
or VALUES or WITH in: "select (1,2) in (1"
+statement error 42000!
SELECT (1,2) IN (1,2)
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '('
or VALUES or WITH in: "select (1,2) in (1"
+statement error 42000!
SELECT (1,2) IN (1)
statement error 42000!Subquery has too few columns
SELECT (col1, col2) IN (VALUES (1)) FROM another_T
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '('
or VALUES or WITH in: "select (col1, col2) in (1"
+statement error 42000!
SELECT (col1, col2) IN (1) FROM another_T
-statement error 42000!syntax error, unexpected sqlINT, expecting SELECT or '('
or VALUES or WITH in: "select col1 from another_t where (col2, col3) in (1"
+statement error 42000!
SELECT col1 FROM another_T WHERE (col2, col3) IN (1,2,3)
statement error 42000!Subquery has too few columns
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]