Changeset: 4d5c66ffe3b2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4d5c66ffe3b2
Modified Files:
        sql/server/rel_select.c
        sql/server/rel_unnest.c
        
sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.test
        sql/test/merge-partitions/Tests/mergepart31.test
        sql/test/mergetables/Tests/part-elim.test
        sql/test/miscellaneous/Tests/groupby_prepare.stable.err
        sql/test/miscellaneous/Tests/groupby_prepare.stable.out
        sql/test/prepare/Tests/sqlancer_prepare.sql
        sql/test/prepare/Tests/sqlancer_prepare.stable.out
        sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
Branch: Jul2021
Log Message:

Set list of values types after the supertype is computed. Also delay the 
generation of the label in the list of values to only when is needed


diffs (truncated from 328 to 300 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
@@ -1994,6 +1994,9 @@ rel_in_value_exp(sql_query *query, sql_r
                        append(vals, re);
                }
 
+               if (list_empty(vals))
+                       return sql_error(sql, 02, SQLSTATE(42000) "The list of 
values for IN operator cannot be empty");
+
                values = exp_values(sql->sa, vals);
                exp_label(sql->sa, values, ++sql->label);
                if (is_tuple) {
@@ -2003,13 +2006,27 @@ rel_in_value_exp(sql_query *query, sql_r
                                return NULL;
                        le->f = nvalues;
                } else { /* if it's not a tuple, enforce coersion on the type 
for every element on the list */
-                       sql_subtype super;
-
-                       if (!(values = exp_values_set_supertype(sql, values, 
exp_subtype(le))))
-                               return NULL;
-                       if (rel_binop_check_types(sql, rel ? *rel : NULL, le, 
values, 0) < 0)
-                               return NULL;
-                       supertype(&super, exp_subtype(values), exp_subtype(le));
+                       sql_subtype super, *le_tpe = exp_subtype(le), 
*values_tpe = NULL;
+
+                       for (node *m = vals->h; m; m = m->next) { /* first get 
values supertype */
+                               sql_exp *e = m->data;
+                               sql_subtype *tpe = exp_subtype(e);
+
+                               if (values_tpe && tpe) {
+                                       supertype(&super, values_tpe, tpe);
+                                       *values_tpe = super;
+                               } else if (!values_tpe && tpe) {
+                                       super = *tpe;
+                                       values_tpe = &super;
+                               }
+                       }
+                       if (!le_tpe)
+                               le_tpe = values_tpe;
+                       if (!values_tpe)
+                               values_tpe = le_tpe;
+                       if (!le_tpe || !values_tpe)
+                               return sql_error(sql, 01, SQLSTATE(42000) "For 
the IN operator, both sides must have a type defined");
+                       supertype(&super, values_tpe, le_tpe); /* compute 
supertype */
 
                        /* on selection/join cases we can generate cmp 
expressions instead of anyequal for trivial cases */
                        if ((is_sql_where(f) || is_sql_having(f)) && 
!is_sql_farg(f) && !exp_has_rel(le) && exps_are_atoms(vals)) {
@@ -2027,8 +2044,14 @@ rel_in_value_exp(sql_query *query, sql_r
                                        e = exp_in(sql->sa, le, vals, 
(sc->token == SQL_IN) ? cmp_in : cmp_notin);
                                }
                        }
-                       if (!e && (le = exp_check_type(sql, &super, rel ? *rel 
: NULL, le, type_equal)) == NULL)
-                               return NULL;
+                       if (!e) { /* after computing supertype, check types for 
each IN value */
+                               for (node *n = vals->h ; n ; n = n->next)
+                                       if ((n->data = exp_check_type(sql, 
&super, rel ? *rel : NULL, n->data, type_equal)) == NULL)
+                                               return NULL;
+                               values->tpe = *exp_subtype(vals->h->data);
+                               if (!(le = exp_check_type(sql, &super, rel ? 
*rel : NULL, le, type_equal)))
+                                       return NULL;
+                       }
                }
                if (!e) {
                        if (add_select && rel && *rel && 
!is_project((*rel)->op) && !is_select((*rel)->op))
diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c
--- a/sql/server/rel_unnest.c
+++ b/sql/server/rel_unnest.c
@@ -2459,6 +2459,7 @@ rel_union_exps(mvc *sql, sql_exp **l, li
                sql_exp *ve = n->data, *r, *s;
                sql_rel *sq = NULL;
 
+               exp_label(sql->sa, ve, ++sql->label); /* an alias is needed */
                if (exp_has_rel(ve)) {
                        sq = exp_rel_get_rel(sql->sa, ve); /* get subquery */
                        if (sq)
diff --git 
a/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.test
 
b/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.test
--- 
a/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.test
+++ 
b/sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.test
@@ -185,7 +185,7 @@ top N (
 | | | | ) [ "a3"."t3pkcol" HASHCOL  = "table1"."t1cold113" ],
 | | | | table("sys"."table12") [ "table12"."t12cola1" ] COUNT 
 | | | ) [ "table12"."t12cola1" = "table1"."t1cola1" ]
-| | ) [ ((((((((((((((("table1"."t1cold1") FILTER "like" (clob "%a%", clob "", 
boolean "true")) or (("table1"."t1cola1") FILTER "like" (clob "%a%", clob "", 
boolean "true"))) or (("table1"."t1colb1") FILTER "like" (clob "%a%", clob "", 
boolean "true"))) or (("table1"."t1cola11") FILTER "like" (clob "%business%", 
clob "", boolean "true"))) or ("table1"."t1colc91" >= timestamp(7) "2016-03-21 
05:00:00.000000")) or ("table1"."t1cola101" = tinyint "1")) or 
(("table1"."t1cola12") FILTER "like" (clob "%Vijay%", clob "", boolean 
"true"))) or (("table2"."t2cola1") ! FILTER "like" (clob "%gmail%", clob "", 
boolean "true"), ("table2"."t2cola1") ! FILTER "like" (clob "%yahoo%", clob "", 
boolean "true"))) or (("table2"."t2cola1") FILTER "like" (clob 
"%efequitygroup.com%", clob "", boolean "true"))) or ("table4"."t4cola1" = clob 
"Customer")) or ("table4"."t4cola2" ! * = clob "NULL")) or ("table2"."t2cola81" 
>= date "2009-08-31")) or ((("table5"."t5cola1" = clob "BAT") or 
(("table5"."t5cola2") FIL
 TER "like" (clob "%AUSTRALIA%", clob "", boolean "true"))) or 
(("table5"."t5cola2") FILTER "like" (clob "%Monet%", clob "", boolean "true"), 
"table5"."t5cola3" = clob "Facebook", "table5"."t5cola5" = clob "new", 
"table5"."t5cola81" > date "2015-07-30"))) or ((("table10"."t10cola1" != clob 
"Completed", "table9"."t9cola1" = clob "Tasks", "table9"."t9cola91" >= 
timestamp(7) "2012-01-01 04:32:27.000000", "table10"."t10cola91" <= 
timestamp(7) "2013-01-01 04:32:27.000000") or ("table9"."t9cola1" = clob 
"Events", timestamp(7) "2012-01-01 04:32:27.000000" <= "table11"."t11cola91" <= 
timestamp(7) "2013-01-01 04:32:27.000000" BETWEEN )) or ("table9"."t9cola1" = 
clob "Calls", timestamp(7) "2012-01-01 04:32:27.000000" <= 
"table10"."t10cola91" <= timestamp(7) "2013-01-01 04:32:27.000000" BETWEEN )), 
"table1"."t1cold111" in (bigint "15842000014793046" as "%2"."%2", bigint 
"15842000017701488" as "%3"."%3", bigint "15842000000024019" as "%4"."%4", 
bigint "15842000000074007" as "%5"."%5", bigint "15
 842000009358096" as "%6"."%6", bigint "15842000010487625" as "%7"."%7", bigint 
"15842000006731919" as "%10"."%10", bigint "15842000002590112" as "%11"."%11", 
bigint "15842000000019001" as "%12"."%12", bigint "15842000014923682" as 
"%13"."%13", bigint "15842000027547249" as "%14"."%14")) or 
("table12"."t12cola1" in (clob[bigint "15842000280111951"] NOT NULL, 
clob[bigint "15842000280163015"] NOT NULL)) ]
+| | ) [ ((((((((((((((("table1"."t1cold1") FILTER "like" (clob "%a%", clob "", 
boolean "true")) or (("table1"."t1cola1") FILTER "like" (clob "%a%", clob "", 
boolean "true"))) or (("table1"."t1colb1") FILTER "like" (clob "%a%", clob "", 
boolean "true"))) or (("table1"."t1cola11") FILTER "like" (clob "%business%", 
clob "", boolean "true"))) or ("table1"."t1colc91" >= timestamp(7) "2016-03-21 
05:00:00.000000")) or ("table1"."t1cola101" = tinyint "1")) or 
(("table1"."t1cola12") FILTER "like" (clob "%Vijay%", clob "", boolean 
"true"))) or (("table2"."t2cola1") ! FILTER "like" (clob "%gmail%", clob "", 
boolean "true"), ("table2"."t2cola1") ! FILTER "like" (clob "%yahoo%", clob "", 
boolean "true"))) or (("table2"."t2cola1") FILTER "like" (clob 
"%efequitygroup.com%", clob "", boolean "true"))) or ("table4"."t4cola1" = clob 
"Customer")) or ("table4"."t4cola2" ! * = clob "NULL")) or ("table2"."t2cola81" 
>= date "2009-08-31")) or ((("table5"."t5cola1" = clob "BAT") or 
(("table5"."t5cola2") FIL
 TER "like" (clob "%AUSTRALIA%", clob "", boolean "true"))) or 
(("table5"."t5cola2") FILTER "like" (clob "%Monet%", clob "", boolean "true"), 
"table5"."t5cola3" = clob "Facebook", "table5"."t5cola5" = clob "new", 
"table5"."t5cola81" > date "2015-07-30"))) or ((("table10"."t10cola1" != clob 
"Completed", "table9"."t9cola1" = clob "Tasks", "table9"."t9cola91" >= 
timestamp(7) "2012-01-01 04:32:27.000000", "table10"."t10cola91" <= 
timestamp(7) "2013-01-01 04:32:27.000000") or ("table9"."t9cola1" = clob 
"Events", timestamp(7) "2012-01-01 04:32:27.000000" <= "table11"."t11cola91" <= 
timestamp(7) "2013-01-01 04:32:27.000000" BETWEEN )) or ("table9"."t9cola1" = 
clob "Calls", timestamp(7) "2012-01-01 04:32:27.000000" <= 
"table10"."t10cola91" <= timestamp(7) "2013-01-01 04:32:27.000000" BETWEEN )), 
"table1"."t1cold111" in (bigint "15842000014793046", bigint 
"15842000017701488", bigint "15842000000024019", bigint "15842000000074007", 
bigint "15842000009358096", bigint "15842000010487625", bigint
  "15842000006731919", bigint "15842000002590112", bigint "15842000000019001", 
bigint "15842000014923682", bigint "15842000027547249")) or 
("table12"."t12cola1" in (clob[bigint "15842000280111951"] NOT NULL, 
clob[bigint "15842000280163015"] NOT NULL)) ]
 | ) [ "table1"."t1pkcol" NOT NULL HASHCOL , "table1"."t1cola82", 
"table2"."t2cola10", "table1"."t1cola1", "table1"."t1cola91", "a1"."t3cola1" ] 
[ "table2"."t2cola82" NULLS LAST ]
 ) [ bigint "10", bigint "0" ]
 
diff --git a/sql/test/merge-partitions/Tests/mergepart31.test 
b/sql/test/merge-partitions/Tests/mergepart31.test
--- a/sql/test/merge-partitions/Tests/mergepart31.test
+++ b/sql/test/merge-partitions/Tests/mergepart31.test
@@ -43,7 +43,7 @@ plan select 1 from splitted where stamp 
 project (
 | select (
 | | table("sys"."first_decade") [ "first_decade"."stamp" as "splitted"."stamp" 
] COUNT 
-| ) [ "splitted"."stamp" in (timestamp(7) "2000-01-01 00:00:00.000000" as 
"%2"."%2", timestamp(7) "2000-02-01 00:00:00.000000" as "%3"."%3") ]
+| ) [ "splitted"."stamp" in (timestamp(7) "2000-01-01 00:00:00.000000", 
timestamp(7) "2000-02-01 00:00:00.000000") ]
 ) [ tinyint "1" ]
 
 query T nosort
@@ -53,14 +53,14 @@ union (
 | project (
 | | select (
 | | | table("sys"."first_decade") [ "first_decade"."stamp" as 
"splitted"."stamp" ] COUNT 
-| | ) [ "splitted"."stamp" in (timestamp(7) "2000-01-01 00:00:00.000000" as 
"%2"."%2", timestamp(7) "2010-01-01 00:00:00.000000" as "%3"."%3") ]
+| | ) [ "splitted"."stamp" in (timestamp(7) "2000-01-01 00:00:00.000000", 
timestamp(7) "2010-01-01 00:00:00.000000") ]
 | ) [ tinyint "1" ],
 | project (
 | | select (
 | | | table("sys"."second_decade") [ "second_decade"."stamp" as 
"splitted"."stamp" ] COUNT 
-| | ) [ "splitted"."stamp" in (timestamp(7) "2000-01-01 00:00:00.000000" as 
"%2"."%2", timestamp(7) "2010-01-01 00:00:00.000000" as "%3"."%3") ]
+| | ) [ "splitted"."stamp" in (timestamp(7) "2000-01-01 00:00:00.000000", 
timestamp(7) "2010-01-01 00:00:00.000000") ]
 | ) [ tinyint "1" ]
-) [ "%10"."%10" NOT NULL ]
+) [ "%6"."%6" NOT NULL ]
 
 query T nosort
 plan select 1 from splitted where stamp IN (TIMESTAMP '2000-02-01 00:00:00', 
TIMESTAMP '2010-02-01 00:00:00', TIMESTAMP '2020-02-01 00:00:00')
@@ -70,20 +70,20 @@ union (
 | | project (
 | | | select (
 | | | | table("sys"."first_decade") [ "first_decade"."stamp" as 
"splitted"."stamp" ] COUNT 
-| | | ) [ "splitted"."stamp" in (timestamp(7) "2000-02-01 00:00:00.000000" as 
"%2"."%2", timestamp(7) "2010-02-01 00:00:00.000000" as "%3"."%3", timestamp(7) 
"2020-02-01 00:00:00.000000" as "%4"."%4") ]
+| | | ) [ "splitted"."stamp" in (timestamp(7) "2000-02-01 00:00:00.000000", 
timestamp(7) "2010-02-01 00:00:00.000000", timestamp(7) "2020-02-01 
00:00:00.000000") ]
 | | ) [ tinyint "1" ],
 | | project (
 | | | select (
 | | | | table("sys"."second_decade") [ "second_decade"."stamp" as 
"splitted"."stamp" ] COUNT 
-| | | ) [ "splitted"."stamp" in (timestamp(7) "2000-02-01 00:00:00.000000" as 
"%2"."%2", timestamp(7) "2010-02-01 00:00:00.000000" as "%3"."%3", timestamp(7) 
"2020-02-01 00:00:00.000000" as "%4"."%4") ]
+| | | ) [ "splitted"."stamp" in (timestamp(7) "2000-02-01 00:00:00.000000", 
timestamp(7) "2010-02-01 00:00:00.000000", timestamp(7) "2020-02-01 
00:00:00.000000") ]
 | | ) [ tinyint "1" ]
-| ) [ "%15"."%15" NOT NULL ],
+| ) [ "%12"."%12" NOT NULL ],
 | project (
 | | select (
 | | | table("sys"."third_decade") [ "third_decade"."stamp" as 
"splitted"."stamp" ] COUNT 
-| | ) [ "splitted"."stamp" in (timestamp(7) "2000-02-01 00:00:00.000000" as 
"%2"."%2", timestamp(7) "2010-02-01 00:00:00.000000" as "%3"."%3", timestamp(7) 
"2020-02-01 00:00:00.000000" as "%4"."%4") ]
+| | ) [ "splitted"."stamp" in (timestamp(7) "2000-02-01 00:00:00.000000", 
timestamp(7) "2010-02-01 00:00:00.000000", timestamp(7) "2020-02-01 
00:00:00.000000") ]
 | ) [ tinyint "1" ]
-) [ "%14"."%14" NOT NULL ]
+) [ "%11"."%11" NOT NULL ]
 
 query T nosort
 plan select 1 from splitted where stamp BETWEEN TIMESTAMP '2020-01-01 
00:00:00' AND TIMESTAMP '2020-10-01 00:00:00'
@@ -538,7 +538,7 @@ plan select 1 from splitted2 where stamp
 project (
 | select (
 | | table("sys"."first_decade2") [ "first_decade2"."stamp" as 
"splitted2"."stamp" ] COUNT 
-| ) [ "splitted2"."stamp" in (int "2" as "%2"."%2", int "1" as "%3"."%3") ]
+| ) [ "splitted2"."stamp" in (int "2", int "1") ]
 ) [ tinyint "1" ]
 
 query T nosort
@@ -556,7 +556,7 @@ plan select 1 from splitted2 where stamp
 project (
 | select (
 | | table("sys"."third_decade2") [ "third_decade2"."stamp" as 
"splitted2"."stamp" ] COUNT 
-| ) [ "splitted2"."stamp" in (int "5" as "%2"."%2", int "6" as "%3"."%3"), 
"splitted2"."stamp" in (int "6" as "%5"."%5", int "7" as "%6"."%6") ]
+| ) [ "splitted2"."stamp" in (int "5", int "6"), "splitted2"."stamp" in (int 
"6", int "7") ]
 ) [ tinyint "1" ]
 
 query T nosort
@@ -565,7 +565,7 @@ plan select 1 from splitted2 where stamp
 project (
 | select (
 | | table("sys"."third_decade2") [ "third_decade2"."stamp" as 
"splitted2"."stamp" ] COUNT 
-| ) [ "splitted2"."stamp" > int "100", "splitted2"."stamp" in (int "5" as 
"%2"."%2", int "6" as "%3"."%3") ]
+| ) [ "splitted2"."stamp" > int "100", "splitted2"."stamp" in (int "5", int 
"6") ]
 ) [ tinyint "1" ]
 
 query T nosort
diff --git a/sql/test/mergetables/Tests/part-elim.test 
b/sql/test/mergetables/Tests/part-elim.test
--- a/sql/test/mergetables/Tests/part-elim.test
+++ b/sql/test/mergetables/Tests/part-elim.test
@@ -138,12 +138,12 @@ union (
 | project (
 | | select (
 | | | table("sys"."mt1") [ "mt1"."id" as "test"."id", "mt1"."posx" as 
"test"."posx" ] COUNT 
-| | ) [ "test"."id" in (bigint "1" as "%2"."%2", bigint "1022" as "%3"."%3") ]
+| | ) [ "test"."id" in (bigint "1", bigint "1022") ]
 | ) [ "test"."id", "test"."posx" ],
 | project (
 | | select (
 | | | table("sys"."mt2") [ "mt2"."id" as "test"."id", "mt2"."posx" as 
"test"."posx" ] COUNT 
-| | ) [ "test"."id" in (bigint "1" as "%2"."%2", bigint "1022" as "%3"."%3") ]
+| | ) [ "test"."id" in (bigint "1", bigint "1022") ]
 | ) [ "test"."id", "test"."posx" ]
 ) [ "test"."id", "test"."posx" ]
 
@@ -153,7 +153,7 @@ plan select * from test where id in (1, 
 project (
 | select (
 | | table("sys"."mt2") [ "mt2"."id" as "test"."id", "mt2"."posx" as 
"test"."posx" ] COUNT 
-| ) [ "test"."id" in (bigint "1" as "%2"."%2", bigint "1000" as "%3"."%3") ]
+| ) [ "test"."id" in (bigint "1", bigint "1000") ]
 ) [ "test"."id", "test"."posx" ]
 
 statement ok
diff --git a/sql/test/miscellaneous/Tests/groupby_prepare.stable.err 
b/sql/test/miscellaneous/Tests/groupby_prepare.stable.err
--- a/sql/test/miscellaneous/Tests/groupby_prepare.stable.err
+++ b/sql/test/miscellaneous/Tests/groupby_prepare.stable.err
@@ -1,6 +1,6 @@
 MAPI  = (monetdb) /var/tmp/mtest-75295/.s.monetdb.36655
 QUERY = prepare select col0 from tab0 where (?) in (?); --error
-ERROR = !Cannot have a parameter (?) on both sides of an expression
+ERROR = !For the IN operator, both sides must have a type defined
 CODE  = 42000
 MAPI  = (monetdb) /var/tmp/mtest-75295/.s.monetdb.36655
 QUERY = prepare select ? = ALL (select ? from tab0) from tab0 t1; --error
diff --git a/sql/test/miscellaneous/Tests/groupby_prepare.stable.out 
b/sql/test/miscellaneous/Tests/groupby_prepare.stable.out
--- a/sql/test/miscellaneous/Tests/groupby_prepare.stable.out
+++ b/sql/test/miscellaneous/Tests/groupby_prepare.stable.out
@@ -144,7 +144,7 @@
 % type,        digits, scale,  schema, table,  column # name
 % varchar,     int,    int,    str,    str,    str # type
 % 7,   2,      1,      0,      3,      3 # length
-[ "tinyint",   1,      0,      "",     "%10",  "%10"   ]
+[ "tinyint",   1,      0,      "",     "%11",  "%11"   ]
 [ "int",       32,     0,      NULL,   NULL,   NULL    ]
 [ "clob",      0,      0,      NULL,   NULL,   NULL    ]
 #drop table tab0;
diff --git a/sql/test/prepare/Tests/sqlancer_prepare.sql 
b/sql/test/prepare/Tests/sqlancer_prepare.sql
--- a/sql/test/prepare/Tests/sqlancer_prepare.sql
+++ b/sql/test/prepare/Tests/sqlancer_prepare.sql
@@ -64,3 +64,6 @@ CREATE FUNCTION myintudf(a INT) RETURNS 
 PREPARE SELECT myintudf(?);
 EXEC **(1);
 ROLLBACK;
+
+PREPARE SELECT "quarter"(date '2021-01-02') IN ("second"(TIME '01:00:00'), 
(select ? where true));
+PREPARE SELECT "quarter"(date '2021-01-02') IN ("second"(TIME '01:00:00'), 
(select ? where true));
diff --git a/sql/test/prepare/Tests/sqlancer_prepare.stable.out 
b/sql/test/prepare/Tests/sqlancer_prepare.stable.out
--- a/sql/test/prepare/Tests/sqlancer_prepare.stable.out
+++ b/sql/test/prepare/Tests/sqlancer_prepare.stable.out
@@ -12,7 +12,7 @@
 % varchar,     int,    int,    str,    str,    str # type
 % 12,  3,      1,      0,      3,      2 # length
 [ "boolean",   1,      0,      "",     "%10",  "c0"    ]
-[ "sec_interval",      13,     0,      "",     "%10",  "%2"    ]
+[ "sec_interval",      13,     0,      "",     "%10",  "%1"    ]
 [ "boolean",   1,      0,      NULL,   NULL,   NULL    ]
 [ "sec_interval",      13,     0,      NULL,   NULL,   NULL    ]
 #ROLLBACK;
@@ -28,7 +28,7 @@
 % type,        digits, scale,  schema, table,  column # name
 % varchar,     int,    int,    str,    str,    str # type
 % 7,   3,      1,      0,      3,      3 # length
-[ "decimal",   2,      1,      "",     "%22",  "%14"   ]
+[ "decimal",   2,      1,      "",     "%22",  "%13"   ]
 [ "int",       32,     0,      "",     "%22",  "c2"    ]
 [ "decimal",   2,      1,      NULL,   NULL,   NULL    ]
 [ "int",       32,     0,      NULL,   NULL,   NULL    ]
@@ -77,7 +77,7 @@
 % type,        digits, scale,  schema, table,  column # name
 % varchar,     int,    int,    str,    str,    str # type
 % 7,   3,      1,      0,      3,      2 # length
-[ "bigint",    64,     0,      "",     "%10",  "%3"    ]
+[ "bigint",    64,     0,      "",     "%10",  "%2"    ]
 [ "char",      0,      0,      NULL,   NULL,   NULL    ]
 [ "bigint",    64,     0,      NULL,   NULL,   NULL    ]
 [ "tinyint",   5,      0,      NULL,   NULL,   NULL    ]
@@ -127,3 +127,18 @@
 % 1 # length
 [ 2    ]
 #ROLLBACK;
+#PREPARE SELECT "quarter"(date '2021-01-02') IN ("second"(TIME '01:00:00'), 
(select ? where true));
+% .prepare,    .prepare,       .prepare,       .prepare,       .prepare,       
.prepare # table_name
+% type,        digits, scale,  schema, table,  column # name
+% varchar,     int,    int,    str,    str,    str # type
+% 7,   2,      1,      0,      2,      2 # length
+[ "boolean",   1,      0,      "",     "%11",  "%11"   ]
+[ "decimal",   16,     6,      NULL,   NULL,   NULL    ]
+#PREPARE SELECT "quarter"(date '2021-01-02') IN ("second"(TIME '01:00:00'), 
(select ? where true));
+% .prepare,    .prepare,       .prepare,       .prepare,       .prepare,       
.prepare # table_name
+% type,        digits, scale,  schema, table,  column # name
+% varchar,     int,    int,    str,    str,    str # type
+% 7,   2,      1,      0,      2,      2 # length
+[ "boolean",   1,      0,      "",     "%11",  "%11"   ]
+[ "decimal",   16,     6,      NULL,   NULL,   NULL    ]
+
diff --git a/sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128 
b/sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
--- a/sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
+++ b/sql/test/prepare/Tests/sqlancer_prepare.stable.out.int128
@@ -12,7 +12,7 @@
 % varchar,     int,    int,    str,    str,    str # type
 % 12,  3,      1,      0,      3,      2 # length
 [ "boolean",   1,      0,      "",     "%10",  "c0"    ]
-[ "sec_interval",      13,     0,      "",     "%10",  "%2"    ]
+[ "sec_interval",      13,     0,      "",     "%10",  "%1"    ]
 [ "boolean",   1,      0,      NULL,   NULL,   NULL    ]
 [ "sec_interval",      13,     0,      NULL,   NULL,   NULL    ]
 #ROLLBACK;
@@ -28,7 +28,7 @@
 % type,        digits, scale,  schema, table,  column # name
 % varchar,     int,    int,    str,    str,    str # type
 % 7,   3,      1,      0,      3,      3 # length
-[ "decimal",   2,      1,      "",     "%22",  "%14"   ]
+[ "decimal",   2,      1,      "",     "%22",  "%13"   ]
 [ "int",       32,     0,      "",     "%22",  "c2"    ]
 [ "decimal",   2,      1,      NULL,   NULL,   NULL    ]
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to