Changeset: 9600b10bdd33 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9600b10bdd33
Modified Files:
        sql/backends/monet5/sql_statement.c
        
sql/test/BugTracker-2008/Tests/varchar_char_semantics.SF-2075085.stable.out
        sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
        
sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
        sql/test/pg_regress/Tests/strings.stable.out
        sql/test/pg_regress/Tests/strings_cast.stable.out
Branch: Oct2020
Log Message:

The same for conversion statements


diffs (110 lines):

diff --git a/sql/backends/monet5/sql_statement.c 
b/sql/backends/monet5/sql_statement.c
--- a/sql/backends/monet5/sql_statement.c
+++ b/sql/backends/monet5/sql_statement.c
@@ -3063,13 +3063,14 @@ stmt_convert(backend *be, stmt *v, stmt 
        if (v->nr < 0)
                return NULL;
 
-       if (t->type->localtype == f->type->localtype &&
+       if ((t->type->localtype == f->type->localtype &&
            (t->type->eclass == f->type->eclass ||
             (EC_VARCHAR(f->type->eclass) && EC_VARCHAR(t->type->eclass))) &&
            !EC_INTERVAL(f->type->eclass) &&
            f->type->eclass != EC_DEC &&
            (t->digits == 0 || f->digits == t->digits) &&
-           type_has_tz(t) == type_has_tz(f)) {
+           type_has_tz(t) == type_has_tz(f)) || 
+               (EC_VARCHAR(f->type->eclass) && EC_VARCHAR(t->type->eclass) && 
f->digits > 0 && t->digits >= f->digits)) {
                /* set output type. Despite the MAL code already being 
generated,
                   the output type may still be checked */
                tail_set_type(v, t);
diff --git 
a/sql/test/BugTracker-2008/Tests/varchar_char_semantics.SF-2075085.stable.out 
b/sql/test/BugTracker-2008/Tests/varchar_char_semantics.SF-2075085.stable.out
--- 
a/sql/test/BugTracker-2008/Tests/varchar_char_semantics.SF-2075085.stable.out
+++ 
b/sql/test/BugTracker-2008/Tests/varchar_char_semantics.SF-2075085.stable.out
@@ -31,7 +31,7 @@ stdout of test 'varchar_char_semantics.S
 [ 10,  "1234567890",   "1234567890"    ]
 [ 5,   "12345 ",       "12345" ]
 #SELECT COUNT(*) FROM T850 WHERE T850C = T850VC;
-% .%1 # table_name
+% sys.%1 # table_name
 % %1 # name
 % bigint # type
 % 1 # length
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
--- a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
+++ b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out
@@ -5664,8 +5664,8 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, convert(v, varchar(36)) from T_char;
 % sys.t_char,  sys.%1 # table_name
 % v,   %1 # name
-% char,        varchar # type
-% 33,  27 # length
+% char,        char # type
+% 33,  33 # length
 [ "0", "0"     ]
 [ "1", "1"     ]
 [ "0123456789",        "0123456789"    ]
@@ -5825,8 +5825,8 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, cast(v as varchar(36)) from T_char;
 % sys.t_char,  sys.%1 # table_name
 % v,   %1 # name
-% char,        varchar # type
-% 33,  27 # length
+% char,        char # type
+% 33,  33 # length
 [ "0", "0"     ]
 [ "1", "1"     ]
 [ "0123456789",        "0123456789"    ]
diff --git 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
--- 
a/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
+++ 
b/sql/test/BugTracker-2016/Tests/convert-function-test.Bug-3460.stable.out.int128
@@ -5969,8 +5969,8 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, convert(v, varchar(36)) from T_char;
 % sys.t_char,  sys.%1 # table_name
 % v,   %1 # name
-% char,        varchar # type
-% 33,  27 # length
+% char,        char # type
+% 33,  33 # length
 [ "0", "0"     ]
 [ "1", "1"     ]
 [ "0123456789",        "0123456789"    ]
@@ -6137,8 +6137,8 @@ stdout of test 'convert-function-test.Bu
 #SELECT v, cast(v as varchar(36)) from T_char;
 % sys.t_char,  sys.%1 # table_name
 % v,   %1 # name
-% char,        varchar # type
-% 33,  27 # length
+% char,        char # type
+% 33,  33 # length
 [ "0", "0"     ]
 [ "1", "1"     ]
 [ "0123456789",        "0123456789"    ]
diff --git a/sql/test/pg_regress/Tests/strings.stable.out 
b/sql/test/pg_regress/Tests/strings.stable.out
--- a/sql/test/pg_regress/Tests/strings.stable.out
+++ b/sql/test/pg_regress/Tests/strings.stable.out
@@ -123,8 +123,8 @@ stdout of test 'strings` in directory 's
 #SELECT CAST(f1 AS char(10)) AS "char(varchar)" FROM VARCHAR_TBL;
 % sys. # table_name
 % char(varchar) # name
-% char # type
-% 10 # length
+% varchar # type
+% 1 # length
 [ "a"  ]
 [ "A"  ]
 [ "1"  ]
diff --git a/sql/test/pg_regress/Tests/strings_cast.stable.out 
b/sql/test/pg_regress/Tests/strings_cast.stable.out
--- a/sql/test/pg_regress/Tests/strings_cast.stable.out
+++ b/sql/test/pg_regress/Tests/strings_cast.stable.out
@@ -109,8 +109,8 @@ stdout of test 'strings_cast` in directo
 #SELECT CAST(f1 AS char(10)) AS "char(varchar)" FROM VARCHAR_TBL;
 % sys. # table_name
 % char(varchar) # name
-% char # type
-% 10 # length
+% varchar # type
+% 4 # length
 [ "a"  ]
 [ "ab" ]
 [ "abcd"       ]
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to