Changeset: f33f3be86538 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f33f3be86538 Modified Files: sql/common/sql_types.c sql/server/sql_semantic.c sql/test/BugTracker-2016/Tests/memory-consumption-query-PLAN-25joins.Bug-3972.test sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.stable.out sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out Branch: default Log Message:
Create clob type first, so functions will bound to that type more likely (uses cheaper conversion compared to (var)char). Also allow converting from blobs to char. diffs (75 lines): diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -98,7 +98,7 @@ static int convert_matrix[EC_MAX][EC_MAX /* EC_BIT */ { 0, 0, 1, 1, 1, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* EC_CHAR */ { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, /* EC_STRING */ { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, -/* EC_BLOB */ { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, +/* EC_BLOB */ { 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* EC_POS */ { 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, /* EC_NUM */ { 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 }, /* EC_MONTH*/ { 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -763,9 +763,10 @@ sqltypeinit( sql_allocator *sa) sql_create_alias(sa, BIT->sqlname, "BOOL"); strings = t; + /* create clob type first, so functions by default will bind to the clob version which doesn't require length validation on some cases */ + STR = *t++ = sql_create_type(sa, "CLOB", 0, 0, 0, EC_STRING, "str"); + *t++ = sql_create_type(sa, "VARCHAR", 0, 0, 0, EC_STRING, "str"); *t++ = sql_create_type(sa, "CHAR", 0, 0, 0, EC_CHAR, "str"); - STR = *t++ = sql_create_type(sa, "VARCHAR", 0, 0, 0, EC_STRING, "str"); - *t++ = sql_create_type(sa, "CLOB", 0, 0, 0, EC_STRING, "str"); numerical = t; #if SIZEOF_OID == SIZEOF_INT diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c --- a/sql/server/sql_semantic.c +++ b/sql/server/sql_semantic.c @@ -1035,8 +1035,9 @@ supertype(sql_subtype *super, sql_subtyp sql_subtype lsuper; lsuper = *r; + /* EC_STRING class is superior to EC_CHAR */ if (i->type->base.id > r->type->base.id || - (EC_VARCHAR(i->type->eclass) && !EC_VARCHAR(r->type->eclass))) { + (EC_VARCHAR(i->type->eclass) && !EC_VARCHAR(r->type->eclass)) || i->type->eclass == EC_STRING) { lsuper = *i; radix = i->type->radix; tpe = i->type->sqlname; 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" ] -| | ) [ (((((((((((((((char["table1"."t1cold1"] as "table1"."t1cold1") FILTER "ilike" (char "%a%", char "")) or ((char["table1"."t1cola1"] as "table1"."t1cola1") FILTER "ilike" (char "%a%", char ""))) or ((char["table1"."t1colb1"] as "table1"."t1colb1") FILTER "ilike" (char "%a%", char ""))) or ((char["table1"."t1cola11"] as "table1"."t1cola11") FILTER "ilike" (char "%business%", char ""))) or ("table1"."t1colc91" >= timestamp(7) "2016-03-21 05:00:00.000000")) or ("table1"."t1cola101" = tinyint "1")) or ((char["table1"."t1cola12"] as "table1"."t1cola12") FILTER "ilike" (char "%Vijay%", char ""))) or ((char["table2"."t2cola1"] as "table2"."t2cola1") ! FILTER "ilike" (char "%gmail%", char ""), (char["table2"."t2cola1"] as "table2"."t2cola1") ! FILTER "ilike" (char "%yahoo%", char ""))) or ((char["table2"."t2cola1"] as "table2"."t2cola1") FILTER "ilike" (char "%efequitygroup.com%", char ""))) or ("table4"."t4cola1" = clob "Customer")) or ("table4"."t4cola2" ! * = clob "NULL")) or ("tab le2"."t2cola81" >= date "2009-08-31")) or ((("table5"."t5cola1" = clob "BAT") or ((char["table5"."t5cola2"] as "table5"."t5cola2") FILTER "ilike" (char "%AUSTRALIA%", char ""))) or ((char["table5"."t5cola2"] as "table5"."t5cola2") FILTER "ilike" (char "%Monet%", char ""), "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", b igint "15842000017701488" as "%3"."%3", bigint "15842000000024019" as "%4"."%4", bigint "15842000000074007" as "%5"."%5", bigint "15842000009358096" 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 "ilike" (clob "%a%", clob "")) or (("table1"."t1cola1") FILTER "ilike" (clob "%a%", clob ""))) or (("table1"."t1colb1") FILTER "ilike" (clob "%a%", clob ""))) or (("table1"."t1cola11") FILTER "ilike" (clob "%business%", clob ""))) or ("table1"."t1colc91" >= timestamp(7) "2016-03-21 05:00:00.000000")) or ("table1"."t1cola101" = tinyint "1")) or (("table1"."t1cola12") FILTER "ilike" (clob "%Vijay%", clob ""))) or (("table2"."t2cola1") ! FILTER "ilike" (clob "%gmail%", clob ""), ("table2"."t2cola1") ! FILTER "ilike" (clob "%yahoo%", clob ""))) or (("table2"."t2cola1") FILTER "ilike" (clob "%efequitygroup.com%", clob ""))) 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") FILTER "ilike" (clob "%AUSTRALIA%", clob ""))) or (("table5"."t5cola2") FILTER "ilike" (clob "%Monet%", clob ""), "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 "15842000009358096" 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"."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/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.stable.out b/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.stable.out --- a/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.stable.out +++ b/sql/test/prepare/Tests/prepare_doesnot_like_LIKE.SF-1234205.stable.out @@ -25,7 +25,7 @@ stdout of test 'prepare_doesnot_like_LIK % varchar, int, int, str, str, str # type % 7, 4, 1, 0, 8, 4 # length [ "varchar", 1024, 0, "", "t1234205", "name" ] -[ "char", 0, 0, NULL, NULL, NULL ] +[ "clob", 0, 0, NULL, NULL, NULL ] #execute 3 ('%'); % sys.t1234205 # table_name % name # name diff --git a/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out --- a/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out +++ b/sql/test/prepare/Tests/prepare_unop_crash.Bug-3653.stable.out @@ -31,7 +31,7 @@ stdout of test 'prepare_unop_crash.Bug-3 % varchar, int, int, str, str, str # type % 4, 2, 1, 0, 6, 2 # length [ "int", 32, 0, "", "tables", "id" ] -[ "clob", 0, 0, NULL, NULL, NULL ] +[ "char", 0, 0, NULL, NULL, NULL ] # 08:58:49 > # 08:58:49 > "Done." _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list