diff --git a/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-epilogue.y.c b/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-epilogue.y.c index f803b0e089..42b4f29447 100644 --- a/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-epilogue.y.c +++ b/contrib/babelfishpg_tsql/src/backend_parser/gram-tsql-epilogue.y.c @@ -199,7 +199,8 @@ TsqlFunctionConvert(TypeName *typename, Node *arg, Node *style, bool try, int lo else if (type_oid == typenameTypeId(NULL, makeTypeName("datetime"))) result = (Node *) makeFuncCall(TsqlSystemFuncName("babelfish_conv_helper_to_datetime"), args, COERCE_EXPLICIT_CALL, location); - else if ((strcmp(typename_string, "varchar") == 0) || (strcmp(typename_string, "nvarchar") == 0)) + else if ((strcmp(typename_string, "varchar") == 0) || (strcmp(typename_string, "nvarchar") == 0) || + (strcmp(typename_string, "bpchar") == 0) || (strcmp(typename_string, "nchar") == 0)) { Node *helperFuncCall; diff --git a/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out b/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out index 922d9a930a..bb2985a896 100644 --- a/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out +++ b/test/JDBC/expected/13_9__preparation__sys-columns-dep-vu-prepare.out @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by name; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by name; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out b/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out index 1131ae7133..245f7077a9 100644 --- a/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out +++ b/test/JDBC/expected/BABEL-1994-CHAR-vu-verify.out @@ -130,7 +130,7 @@ select go ~~START~~ char#!#char#!#char#!#char#!#char -2021-08-15 00:00:00 #!#2021-08-15 00:00:00 #!#2021-08-15 00:00:00 #!#decimal #!#a +Aug 15 2021 12:00AM #!#2021-08-15 00:00:00 #!#2021-08-15 00:00:00 #!#decimal #!#a ~~END~~ diff --git a/test/JDBC/expected/BABEL-1994-CHAR.out b/test/JDBC/expected/BABEL-1994-CHAR.out index 2dd9854c68..f5339bda4b 100644 --- a/test/JDBC/expected/BABEL-1994-CHAR.out +++ b/test/JDBC/expected/BABEL-1994-CHAR.out @@ -161,7 +161,7 @@ select go ~~START~~ char#!#char#!#char#!#char#!#char -2021-08-15 00:00:00 #!#2021-08-15 00:00:00 #!#2021-08-15 00:00:00 #!#decimal #!#a +Aug 15 2021 12:00AM #!#2021-08-15 00:00:00 #!#2021-08-15 00:00:00 #!#decimal #!#a ~~END~~ diff --git a/test/JDBC/expected/BABEL-2998.out b/test/JDBC/expected/BABEL-2998.out index af322b960e..27283d6373 100644 --- a/test/JDBC/expected/BABEL-2998.out +++ b/test/JDBC/expected/BABEL-2998.out @@ -22,44 +22,48 @@ GO SELECT CAST('1' AS CHAR(10)) AS Col1 UNION SELECT CAST(NULL AS CHAR(10)) AS Col1 +ORDER BY Col1 GO ~~START~~ char -1 +1 ~~END~~ SELECT CAST('1' AS CHAR(10)) AS Col1 UNION ALL SELECT CONVERT(CHAR(10), NULL) AS Col1 +ORDER BY Col1 GO ~~START~~ char -1 +1 ~~END~~ SELECT CAST('1' AS CHAR(10)) AS Col1 UNION ALL SELECT CAST(NULL AS CHAR(10)) AS Col1 +ORDER BY Col1 GO ~~START~~ char -1 +1 ~~END~~ SELECT CAST('1' AS CHAR(10)) AS Col1 UNION SELECT CONVERT(CHAR(10), NULL) AS Col1 +ORDER BY Col1 GO ~~START~~ char -1 +1 ~~END~~ diff --git a/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-cleanup.out b/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-cleanup.out new file mode 100644 index 0000000000..9df9221ad4 --- /dev/null +++ b/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-cleanup.out @@ -0,0 +1,4 @@ +DROP TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 +DROP TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 +DROP TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 +GO diff --git a/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-prepare.out b/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-prepare.out new file mode 100644 index 0000000000..98e306a7e2 --- /dev/null +++ b/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-prepare.out @@ -0,0 +1,33 @@ +CREATE TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 ( + c [int] NULL, + c_comp AS ISNULL(CONVERT(CHAR(1), 'A'), 'B') +) +GO + +CREATE TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 ( + a numeric(6, 4), + b numeric(6, 3) +) +GO + +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 VALUES (10.1234, 10.123); +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 VALUES (NULL, 101.123); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +CREATE TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 ( + a decimal(6, 4), + b decimal(6, 3) +) +GO + +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 VALUES (10.1234, 10.123); +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 VALUES (NULL, 101.123); +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + diff --git a/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-verify.out b/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-verify.out new file mode 100644 index 0000000000..317b4ba7d7 --- /dev/null +++ b/test/JDBC/expected/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-verify.out @@ -0,0 +1,32 @@ +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 VALUES(1) +GO +~~ROW COUNT: 1~~ + + +SELECT c_comp FROM BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 +GO +~~START~~ +char +A +~~END~~ + + +-- Test ISNULL with numeric columns +SELECT ISNULL(a, b) FROM BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 +GO +~~START~~ +numeric +10.1234 +101.1230 +~~END~~ + + +-- Test ISNULL with decimal columns +SELECT ISNULL(a, b) FROM BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 +GO +~~START~~ +numeric +10.1234 +101.1230 +~~END~~ + diff --git a/test/JDBC/expected/BABEL-3147-vu-cleanup.out b/test/JDBC/expected/BABEL-3147-vu-cleanup.out index c29eb1829c..97ea573903 100644 --- a/test/JDBC/expected/BABEL-3147-vu-cleanup.out +++ b/test/JDBC/expected/BABEL-3147-vu-cleanup.out @@ -1,4 +1,9 @@ +-- error should not have been thrown, should be fixed under BABEL-1710 DROP TABLE BABEL_3147_vu_prepare_t_1 DROP TABLE BABEL_3147_vu_prepare_t_2 DROP TABLE BABEL_3147_vu_prepare_t_3 GO +~~ERROR (Code: 3701)~~ + +~~ERROR (Message: table "babel_3147_vu_prepare_t_1" does not exist)~~ + diff --git a/test/JDBC/expected/BABEL-3147-vu-prepare.out b/test/JDBC/expected/BABEL-3147-vu-prepare.out index ad3f423cb7..f49a9bb1d3 100644 --- a/test/JDBC/expected/BABEL-3147-vu-prepare.out +++ b/test/JDBC/expected/BABEL-3147-vu-prepare.out @@ -1,8 +1,13 @@ +-- error should not have been thrown, should be fixed under BABEL-1710 CREATE TABLE BABEL_3147_vu_prepare_t_1 ( c [int] NULL, c_comp AS ISNULL(CONVERT(CHAR(1), 'A'), 'B') ) GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: generation expression is not immutable)~~ + CREATE TABLE BABEL_3147_vu_prepare_t_2 ( a numeric(6, 4), diff --git a/test/JDBC/expected/BABEL-3147-vu-verify.out b/test/JDBC/expected/BABEL-3147-vu-verify.out index fafdac8cae..40181701f7 100644 --- a/test/JDBC/expected/BABEL-3147-vu-verify.out +++ b/test/JDBC/expected/BABEL-3147-vu-verify.out @@ -1,8 +1,16 @@ +INSERT INTO BABEL_3147_before_14_5_vu_prepare_t_1 VALUES(1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "babel_3147_before_14_5_vu_prepare_t_1" does not exist)~~ + + +-- error should not have been thrown, should be fixed under BABEL-1710 SELECT c_comp FROM BABEL_3147_vu_prepare_t_1 GO -~~START~~ -char -~~END~~ +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: relation "babel_3147_vu_prepare_t_1" does not exist)~~ -- Test ISNULL with numeric columns diff --git a/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-cleanup.out b/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-cleanup.out new file mode 100644 index 0000000000..3e78b7bef3 --- /dev/null +++ b/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-cleanup.out @@ -0,0 +1,175 @@ +-- CHAR +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view1 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view11 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view12 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view2 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view22 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view3 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view31 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func32 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view4 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view5 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view6 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view7 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view8 +GO + +-- NCHAR +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view1 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view11 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view12 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view2 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view22 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view3 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view31 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func32 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view4 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view5 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view6 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view7 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view8 +GO diff --git a/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-prepare.out b/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-prepare.out new file mode 100644 index 0000000000..6b18ac65b4 --- /dev/null +++ b/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-prepare.out @@ -0,0 +1,351 @@ +-- CHAR +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as float)) = CONVERT(CHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as sys.money)) = CONVERT(CHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO + +-- NCHAR +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as float)) = CONVERT(NCHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as sys.money)) = CONVERT(NCHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO diff --git a/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-verify.out b/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-verify.out new file mode 100644 index 0000000000..a4aac16faa --- /dev/null +++ b/test/JDBC/expected/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-verify.out @@ -0,0 +1,291 @@ +-- CHAR +-- customer case +SELECT convert(char(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO +~~START~~ +char +230203 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view1 +GO +~~START~~ +char +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view11 +GO +~~START~~ +char +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view2 +GO +~~START~~ +char +19:08:35.5 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view22 +GO +~~START~~ +char +19:08:35.5 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc1 +GO +~~START~~ +char +2023-02-03 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc11 +GO +~~START~~ +char +03-02-2023 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc2 +GO +~~START~~ +char +19:08:35.5 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc22 +GO +~~START~~ +char +19:08:35 +~~END~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func1() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func11() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func2() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func22() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view3 +GO +~~START~~ +char +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view4 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view5 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view6 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view7 +GO +~~START~~ +text +true +~~END~~ + + +-- NCHAR +-- customer case +SELECT convert(nchar(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO +~~START~~ +nchar +230203 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view1 +GO +~~START~~ +nchar +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view11 +GO +~~START~~ +nchar +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view2 +GO +~~START~~ +nchar +19:08:35.5 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view22 +GO +~~START~~ +nchar +19:08:35.5 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc1 +GO +~~START~~ +nchar +2023-02-03 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc11 +GO +~~START~~ +nchar +03-02-2023 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc2 +GO +~~START~~ +nchar +19:08:35.5 +~~END~~ + + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc22 +GO +~~START~~ +nchar +19:08:35 +~~END~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func1() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func11() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func2() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func22() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view3 +GO +~~START~~ +nchar +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view4 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view5 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view6 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view7 +GO +~~START~~ +text +true +~~END~~ + diff --git a/test/JDBC/expected/BABEL-4641-vu-cleanup.out b/test/JDBC/expected/BABEL-4641-vu-cleanup.out new file mode 100644 index 0000000000..2febbe72ac --- /dev/null +++ b/test/JDBC/expected/BABEL-4641-vu-cleanup.out @@ -0,0 +1,175 @@ +-- CHAR +DROP VIEW babel_4461_char_vu_prepare_view1 +GO + +DROP VIEW babel_4461_char_vu_prepare_view11 +GO + +DROP VIEW babel_4461_char_vu_prepare_view12 +GO + +DROP VIEW babel_4461_char_vu_prepare_view2 +GO + +DROP VIEW babel_4461_char_vu_prepare_view22 +GO + +DROP VIEW babel_4461_char_vu_prepare_view3 +GO + +DROP VIEW babel_4461_char_vu_prepare_view31 +GO + +DROP VIEW babel_4461_char_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func32 +GO + +DROP VIEW babel_4461_char_vu_prepare_view4 +GO + +DROP VIEW babel_4461_char_vu_prepare_view5 +GO + +DROP VIEW babel_4461_char_vu_prepare_view6 +GO + +DROP VIEW babel_4461_char_vu_prepare_view7 +GO + +DROP VIEW babel_4461_char_vu_prepare_view8 +GO + +-- NCHAR +DROP VIEW babel_4461_nchar_vu_prepare_view1 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view11 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view12 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view2 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view22 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view3 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view31 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func32 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view4 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view5 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view6 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view7 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view8 +GO diff --git a/test/JDBC/expected/BABEL-4641-vu-prepare.out b/test/JDBC/expected/BABEL-4641-vu-prepare.out new file mode 100644 index 0000000000..f6dbf2ecc3 --- /dev/null +++ b/test/JDBC/expected/BABEL-4641-vu-prepare.out @@ -0,0 +1,351 @@ +-- CHAR +-- default style +CREATE VIEW babel_4461_char_vu_prepare_view1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_char_vu_prepare_view11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_char_vu_prepare_view2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_char_vu_prepare_view22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_char_vu_prepare_view3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_char_vu_prepare_view31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_char_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_char_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_char_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as float)) = CONVERT(CHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as sys.money)) = CONVERT(CHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO + +-- NCHAR +-- default style +CREATE VIEW babel_4461_nchar_vu_prepare_view1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_nchar_vu_prepare_view11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_nchar_vu_prepare_view2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_nchar_vu_prepare_view22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_nchar_vu_prepare_view3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_nchar_vu_prepare_view31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_nchar_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as float)) = CONVERT(NCHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as sys.money)) = CONVERT(NCHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO diff --git a/test/JDBC/expected/BABEL-4641-vu-verify.out b/test/JDBC/expected/BABEL-4641-vu-verify.out new file mode 100644 index 0000000000..74f9798b3a --- /dev/null +++ b/test/JDBC/expected/BABEL-4641-vu-verify.out @@ -0,0 +1,291 @@ +-- CHAR +-- customer case +SELECT convert(char(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO +~~START~~ +char +230203 +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view1 +GO +~~START~~ +char +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view11 +GO +~~START~~ +char +03-02-2023 +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view2 +GO +~~START~~ +char +19:08:35.5 +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view22 +GO +~~START~~ +char +19:08:35 +~~END~~ + + +EXEC babel_4461_char_vu_prepare_proc1 +GO +~~START~~ +char +2023-02-03 +~~END~~ + + +EXEC babel_4461_char_vu_prepare_proc11 +GO +~~START~~ +char +03-02-2023 +~~END~~ + + +EXEC babel_4461_char_vu_prepare_proc2 +GO +~~START~~ +char +19:08:35.5 +~~END~~ + + +EXEC babel_4461_char_vu_prepare_proc22 +GO +~~START~~ +char +19:08:35 +~~END~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func1() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func11() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func2() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func22() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view3 +GO +~~START~~ +char +Feb 3 202 +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view4 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view5 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view6 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_char_vu_prepare_view7 +GO +~~START~~ +text +true +~~END~~ + + +-- NCHAR +-- customer case +SELECT convert(nchar(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO +~~START~~ +nchar +230203 +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view1 +GO +~~START~~ +nchar +2023-02-03 +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view11 +GO +~~START~~ +nchar +03-02-2023 +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view2 +GO +~~START~~ +nchar +19:08:35.5 +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view22 +GO +~~START~~ +nchar +19:08:35 +~~END~~ + + +EXEC babel_4461_nchar_vu_prepare_proc1 +GO +~~START~~ +nchar +2023-02-03 +~~END~~ + + +EXEC babel_4461_nchar_vu_prepare_proc11 +GO +~~START~~ +nchar +03-02-2023 +~~END~~ + + +EXEC babel_4461_nchar_vu_prepare_proc2 +GO +~~START~~ +nchar +19:08:35.5 +~~END~~ + + +EXEC babel_4461_nchar_vu_prepare_proc22 +GO +~~START~~ +nchar +19:08:35 +~~END~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func1() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func11() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func2() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func22() +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view3 +GO +~~START~~ +nchar +Feb 3 202 +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view4 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view5 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view6 +GO +~~START~~ +text +true +~~END~~ + + +SELECT * FROM babel_4461_nchar_vu_prepare_view7 +GO +~~START~~ +text +true +~~END~~ + diff --git a/test/JDBC/expected/parallel_query/BABEL-2998.out b/test/JDBC/expected/parallel_query/BABEL-2998.out deleted file mode 100644 index 093d1eab99..0000000000 --- a/test/JDBC/expected/parallel_query/BABEL-2998.out +++ /dev/null @@ -1,99 +0,0 @@ --- tsql --- typmod associated with NULL will be -1 so this will throw an error -SELECT CAST('1' AS CHAR(10)) AS Col1 -UNION -SELECT NULL AS Col1 -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ - - -SELECT CAST('1' AS CHAR(10)) AS Col1 -UNION ALL -SELECT NULL AS Col1 -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ - - --- taking suggestion from above error, added explicit CAST and CONVERT -SELECT CAST('1' AS CHAR(10)) AS Col1 -UNION -SELECT CAST(NULL AS CHAR(10)) AS Col1 -GO -~~START~~ -char -1 - -~~END~~ - - -SELECT CAST('1' AS CHAR(10)) AS Col1 -UNION ALL -SELECT CONVERT(CHAR(10), NULL) AS Col1 -GO -~~START~~ -char - -1 -~~END~~ - - -SELECT CAST('1' AS CHAR(10)) AS Col1 -UNION ALL -SELECT CAST(NULL AS CHAR(10)) AS Col1 -GO -~~START~~ -char - -1 -~~END~~ - - -SELECT CAST('1' AS CHAR(10)) AS Col1 -UNION -SELECT CONVERT(CHAR(10), NULL) AS Col1 -GO -~~START~~ -char -1 - -~~END~~ - - --- psql --- create a function from PG endpoint and try calling it from T-SQL endpoint -CREATE FUNCTION sys.func_2998() RETURNS CHAR(20) LANGUAGE SQL RETURN 'abc'; -GO - --- tsql --- throws error -SELECT func_2998() -GO -~~ERROR (Code: 33557097)~~ - -~~ERROR (Message: The string size for the given CHAR/NCHAR data is not defined. Please use an explicit CAST or CONVERT to CHAR(n)/NCHAR(n))~~ - - --- taking suggestion from above error, added explicit CAST and CONVERT -SELECT CAST(func_2998() AS CHAR(20)) -GO -~~START~~ -char -abc -~~END~~ - - -SELECT CONVERT(CHAR(20), func_2998()) -GO -~~START~~ -char -abc -~~END~~ - - --- psql -DROP FUNCTION sys.func_2998() -GO diff --git a/test/JDBC/input/BABEL-2998.mix b/test/JDBC/input/BABEL-2998.mix index bd27048dad..4a6d0b5896 100644 --- a/test/JDBC/input/BABEL-2998.mix +++ b/test/JDBC/input/BABEL-2998.mix @@ -1,4 +1,3 @@ --- parallel_query_expected -- tsql -- typmod associated with NULL will be -1 so this will throw an error SELECT CAST('1' AS CHAR(10)) AS Col1 @@ -15,21 +14,25 @@ GO SELECT CAST('1' AS CHAR(10)) AS Col1 UNION SELECT CAST(NULL AS CHAR(10)) AS Col1 +ORDER BY Col1 GO SELECT CAST('1' AS CHAR(10)) AS Col1 UNION ALL SELECT CONVERT(CHAR(10), NULL) AS Col1 +ORDER BY Col1 GO SELECT CAST('1' AS CHAR(10)) AS Col1 UNION ALL SELECT CAST(NULL AS CHAR(10)) AS Col1 +ORDER BY Col1 GO SELECT CAST('1' AS CHAR(10)) AS Col1 UNION SELECT CONVERT(CHAR(10), NULL) AS Col1 +ORDER BY Col1 GO -- psql diff --git a/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-cleanup.sql b/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-cleanup.sql new file mode 100644 index 0000000000..042c0a7b0a --- /dev/null +++ b/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-cleanup.sql @@ -0,0 +1,4 @@ +DROP TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 +DROP TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 +DROP TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-prepare.sql b/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-prepare.sql new file mode 100644 index 0000000000..3139687782 --- /dev/null +++ b/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-prepare.sql @@ -0,0 +1,25 @@ +CREATE TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 ( + c [int] NULL, + c_comp AS ISNULL(CONVERT(CHAR(1), 'A'), 'B') +) +GO + +CREATE TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 ( + a numeric(6, 4), + b numeric(6, 3) +) +GO + +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 VALUES (10.1234, 10.123); +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 VALUES (NULL, 101.123); +GO + +CREATE TABLE BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 ( + a decimal(6, 4), + b decimal(6, 3) +) +GO + +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 VALUES (10.1234, 10.123); +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 VALUES (NULL, 101.123); +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-verify.sql b/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-verify.sql new file mode 100644 index 0000000000..440e081ea7 --- /dev/null +++ b/test/JDBC/input/BABEL-3147-before-16_3-or-15_7-or-14_12-vu-verify.sql @@ -0,0 +1,13 @@ +INSERT INTO BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 VALUES(1) +GO + +SELECT c_comp FROM BABEL_3147_before_16_3_or_15_7_vu_prepare_t_1 +GO + +-- Test ISNULL with numeric columns +SELECT ISNULL(a, b) FROM BABEL_3147_before_16_3_or_15_7_vu_prepare_t_2 +GO + +-- Test ISNULL with decimal columns +SELECT ISNULL(a, b) FROM BABEL_3147_before_16_3_or_15_7_vu_prepare_t_3 +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-3147-vu-cleanup.sql b/test/JDBC/input/BABEL-3147-vu-cleanup.sql index f65b7cf9b3..30503a7929 100644 --- a/test/JDBC/input/BABEL-3147-vu-cleanup.sql +++ b/test/JDBC/input/BABEL-3147-vu-cleanup.sql @@ -1,3 +1,4 @@ +-- error should not have been thrown, should be fixed under BABEL-1710 DROP TABLE BABEL_3147_vu_prepare_t_1 DROP TABLE BABEL_3147_vu_prepare_t_2 DROP TABLE BABEL_3147_vu_prepare_t_3 diff --git a/test/JDBC/input/BABEL-3147-vu-prepare.sql b/test/JDBC/input/BABEL-3147-vu-prepare.sql index 6802c91db9..db62a8f919 100644 --- a/test/JDBC/input/BABEL-3147-vu-prepare.sql +++ b/test/JDBC/input/BABEL-3147-vu-prepare.sql @@ -1,3 +1,4 @@ +-- error should not have been thrown, should be fixed under BABEL-1710 CREATE TABLE BABEL_3147_vu_prepare_t_1 ( c [int] NULL, c_comp AS ISNULL(CONVERT(CHAR(1), 'A'), 'B') diff --git a/test/JDBC/input/BABEL-3147-vu-verify.sql b/test/JDBC/input/BABEL-3147-vu-verify.sql index 619290d64f..39cd2caf8b 100644 --- a/test/JDBC/input/BABEL-3147-vu-verify.sql +++ b/test/JDBC/input/BABEL-3147-vu-verify.sql @@ -1,3 +1,7 @@ +INSERT INTO BABEL_3147_before_14_5_vu_prepare_t_1 VALUES(1) +GO + +-- error should not have been thrown, should be fixed under BABEL-1710 SELECT c_comp FROM BABEL_3147_vu_prepare_t_1 GO diff --git a/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-cleanup.sql b/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-cleanup.sql new file mode 100644 index 0000000000..250f23806d --- /dev/null +++ b/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-cleanup.sql @@ -0,0 +1,175 @@ +-- CHAR +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view1 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view11 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view12 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view2 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view22 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view3 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view31 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func32 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view4 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view5 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view6 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view7 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view8 +GO + +-- NCHAR +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view1 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view11 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view12 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view2 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view22 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view3 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view31 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func32 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view4 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view5 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view6 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view7 +GO + +DROP VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view8 +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-prepare.sql b/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-prepare.sql new file mode 100644 index 0000000000..4f94f9a432 --- /dev/null +++ b/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-prepare.sql @@ -0,0 +1,351 @@ +-- CHAR +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_char_vu_prepare_proc32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_char_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as float)) = CONVERT(CHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_char_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as sys.money)) = CONVERT(CHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO + +-- NCHAR +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as float)) = CONVERT(NCHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as sys.money)) = CONVERT(NCHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-verify.sql b/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-verify.sql new file mode 100644 index 0000000000..9bd3643d0e --- /dev/null +++ b/test/JDBC/input/BABEL-4641-before-16_3-or-15_7-or-14_12-vu-verify.sql @@ -0,0 +1,119 @@ +-- CHAR +-- customer case +SELECT convert(char(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view1 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view11 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view2 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view22 +GO + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc1 +GO + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc11 +GO + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc2 +GO + +EXEC babel_4461_before_16_3_or_15_7_char_vu_prepare_proc22 +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func1() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func11() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func2() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_func22() +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view3 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view4 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view5 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view6 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_char_vu_prepare_view7 +GO + +-- NCHAR +-- customer case +SELECT convert(nchar(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view1 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view11 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view2 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view22 +GO + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc1 +GO + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc11 +GO + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc2 +GO + +EXEC babel_4461_before_16_3_or_15_7_nchar_vu_prepare_proc22 +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func1() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func11() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func2() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_func22() +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view3 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view4 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view5 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view6 +GO + +SELECT * FROM babel_4461_before_16_3_or_15_7_nchar_vu_prepare_view7 +GO diff --git a/test/JDBC/input/BABEL-4641-vu-cleanup.sql b/test/JDBC/input/BABEL-4641-vu-cleanup.sql new file mode 100644 index 0000000000..aed63fede8 --- /dev/null +++ b/test/JDBC/input/BABEL-4641-vu-cleanup.sql @@ -0,0 +1,175 @@ +-- CHAR +DROP VIEW babel_4461_char_vu_prepare_view1 +GO + +DROP VIEW babel_4461_char_vu_prepare_view11 +GO + +DROP VIEW babel_4461_char_vu_prepare_view12 +GO + +DROP VIEW babel_4461_char_vu_prepare_view2 +GO + +DROP VIEW babel_4461_char_vu_prepare_view22 +GO + +DROP VIEW babel_4461_char_vu_prepare_view3 +GO + +DROP VIEW babel_4461_char_vu_prepare_view31 +GO + +DROP VIEW babel_4461_char_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_char_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_char_vu_prepare_func32 +GO + +DROP VIEW babel_4461_char_vu_prepare_view4 +GO + +DROP VIEW babel_4461_char_vu_prepare_view5 +GO + +DROP VIEW babel_4461_char_vu_prepare_view6 +GO + +DROP VIEW babel_4461_char_vu_prepare_view7 +GO + +DROP VIEW babel_4461_char_vu_prepare_view8 +GO + +-- NCHAR +DROP VIEW babel_4461_nchar_vu_prepare_view1 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view11 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view12 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view2 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view22 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view3 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view31 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view32 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc1 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc11 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc12 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc2 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc22 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc3 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc31 +GO + +DROP PROCEDURE babel_4461_nchar_vu_prepare_proc32 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func1 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func11 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func12 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func2 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func22 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func3 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func31 +GO + +DROP FUNCTION babel_4461_nchar_vu_prepare_func32 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view4 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view5 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view6 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view7 +GO + +DROP VIEW babel_4461_nchar_vu_prepare_view8 +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-4641-vu-prepare.sql b/test/JDBC/input/BABEL-4641-vu-prepare.sql new file mode 100644 index 0000000000..405e76dd12 --- /dev/null +++ b/test/JDBC/input/BABEL-4641-vu-prepare.sql @@ -0,0 +1,351 @@ +-- CHAR +-- default style +CREATE VIEW babel_4461_char_vu_prepare_view1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_char_vu_prepare_view11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_char_vu_prepare_view2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_char_vu_prepare_view22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_char_vu_prepare_view3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_char_vu_prepare_view31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc1 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc11 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc12 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc2 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc22 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc3 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc31 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_char_vu_prepare_proc32 AS +SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_char_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_char_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_char_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_char_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(CHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as float)) = CONVERT(CHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_char_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(CHAR(10), CAST('1.0001' as sys.money)) = CONVERT(CHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO + +-- NCHAR +-- default style +CREATE VIEW babel_4461_nchar_vu_prepare_view1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE VIEW babel_4461_nchar_vu_prepare_view11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE VIEW babel_4461_nchar_vu_prepare_view2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE VIEW babel_4461_nchar_vu_prepare_view22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE VIEW babel_4461_nchar_vu_prepare_view3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE VIEW babel_4461_nchar_vu_prepare_view31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc1 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc11 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc12 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result +GO + +-- default style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc2 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc22 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result +GO + +-- default style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc3 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc31 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result +GO + +-- different style +CREATE PROCEDURE babel_4461_nchar_vu_prepare_proc32 AS +SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result +GO + +-- default style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func1() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func11() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func12() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 12) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func2() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func22() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 20) result) +GO + +-- default style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func3() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func31() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 105) result) +GO + +-- different style +CREATE FUNCTION babel_4461_nchar_vu_prepare_func32() +RETURNS TABLE +AS +RETURN (SELECT CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 12) result) +GO + +-- to verify that is returning expected the default style +CREATE VIEW babel_4461_nchar_vu_prepare_view4 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as DATE), 20) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view5 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as TIME), 25) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view6 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME)) = CONVERT(NCHAR(10), CAST('2023-02-03 19:08:35.527' as sys.DATETIME), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view7 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as float)) = CONVERT(NCHAR(10), CAST('1.0001' as float), 0) + THEN 'true' + else 'false' + END result +GO + +CREATE VIEW babel_4461_nchar_vu_prepare_view8 AS +SELECT CASE + WHEN CONVERT(NCHAR(10), CAST('1.0001' as sys.money)) = CONVERT(NCHAR(10), CAST('1.0001' as sys.money), 0) + THEN 'true' + else 'false' + END result +GO \ No newline at end of file diff --git a/test/JDBC/input/BABEL-4641-vu-verify.sql b/test/JDBC/input/BABEL-4641-vu-verify.sql new file mode 100644 index 0000000000..491c3483c7 --- /dev/null +++ b/test/JDBC/input/BABEL-4641-vu-verify.sql @@ -0,0 +1,119 @@ +-- CHAR +-- customer case +SELECT convert(char(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO + +SELECT * FROM babel_4461_char_vu_prepare_view1 +GO + +SELECT * FROM babel_4461_char_vu_prepare_view11 +GO + +SELECT * FROM babel_4461_char_vu_prepare_view2 +GO + +SELECT * FROM babel_4461_char_vu_prepare_view22 +GO + +EXEC babel_4461_char_vu_prepare_proc1 +GO + +EXEC babel_4461_char_vu_prepare_proc11 +GO + +EXEC babel_4461_char_vu_prepare_proc2 +GO + +EXEC babel_4461_char_vu_prepare_proc22 +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func1() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func11() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func2() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_char_vu_prepare_func22() +GO + +SELECT * FROM babel_4461_char_vu_prepare_view3 +GO + +SELECT * FROM babel_4461_char_vu_prepare_view4 +GO + +SELECT * FROM babel_4461_char_vu_prepare_view5 +GO + +SELECT * FROM babel_4461_char_vu_prepare_view6 +GO + +SELECT * FROM babel_4461_char_vu_prepare_view7 +GO + +-- NCHAR +-- customer case +SELECT convert(nchar(6),CAST('2023-02-03 19:08:35.527' as sys.DATETIME),12) as FDate +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view1 +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view11 +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view2 +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view22 +GO + +EXEC babel_4461_nchar_vu_prepare_proc1 +GO + +EXEC babel_4461_nchar_vu_prepare_proc11 +GO + +EXEC babel_4461_nchar_vu_prepare_proc2 +GO + +EXEC babel_4461_nchar_vu_prepare_proc22 +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func1() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func11() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func2() +GO + +-- error should not have been thrown, should be fixed under BABEL-4561 +SELECT * FROM babel_4461_nchar_vu_prepare_func22() +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view3 +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view4 +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view5 +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view6 +GO + +SELECT * FROM babel_4461_nchar_vu_prepare_view7 +GO diff --git a/test/JDBC/jdbc_schedule b/test/JDBC/jdbc_schedule index ed1268b6f9..3b33f26dca 100644 --- a/test/JDBC/jdbc_schedule +++ b/test/JDBC/jdbc_schedule @@ -145,6 +145,14 @@ ignore#!#orderby-before-14_8-or-15_3-vu-prepare ignore#!#orderby-before-14_8-or-15_3-vu-verify ignore#!#orderby-before-14_8-or-15_3-vu-cleanup +# These tests are meant for upgrade scenario prior to 14_12 or 15_7 or 16_3 release +ignore#!#BABEL-4641-before-16_3-or-15_7-or-14_12-vu-prepare +ignore#!#BABEL-4641-before-16_3-or-15_7-or-14_12-vu-verify +ignore#!#BABEL-4641-before-16_3-or-15_7-or-14_12-vu-cleanup +ignore#!#BABEL-3147-before-16_3-or-15_7-or-14_12-vu-prepare +ignore#!#BABEL-3147-before-16_3-or-15_7-or-14_12-vu-verify +ignore#!#BABEL-3147-before-16_3-or-15_7-or-14_12-vu-cleanup + # These tests are running in multidb mode in upgrade and singledb mode in JDBC ignore#!#BABEL-4279-vu-prepare ignore#!#BABEL-4279-vu-verify diff --git a/test/JDBC/upgrade/13_4/schedule b/test/JDBC/upgrade/13_4/schedule index 417344ff3e..f58ea21bc3 100644 --- a/test/JDBC/upgrade/13_4/schedule +++ b/test/JDBC/upgrade/13_4/schedule @@ -205,3 +205,4 @@ orderby-before-14_8-or-15_3 AUTO_ANALYZE-before-15-5-or-14-10 permission_restrictions_from_pg # babel-4517 created : BABEL-4727 to track the issue +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/13_5/schedule b/test/JDBC/upgrade/13_5/schedule index 37cdeabdea..8fc5cb3d2c 100644 --- a/test/JDBC/upgrade/13_5/schedule +++ b/test/JDBC/upgrade/13_5/schedule @@ -256,3 +256,4 @@ orderby-before-14_8-or-15_3 AUTO_ANALYZE-before-15-5-or-14-10 permission_restrictions_from_pg # babel-4517 created : BABEL-4727 to track the issue +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/13_6/schedule b/test/JDBC/upgrade/13_6/schedule index 063b0c5a5b..70ac806f3c 100644 --- a/test/JDBC/upgrade/13_6/schedule +++ b/test/JDBC/upgrade/13_6/schedule @@ -316,3 +316,4 @@ BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 permission_restrictions_from_pg babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/13_7/schedule b/test/JDBC/upgrade/13_7/schedule index c5cb7a6b55..3cd8f0f87d 100644 --- a/test/JDBC/upgrade/13_7/schedule +++ b/test/JDBC/upgrade/13_7/schedule @@ -316,3 +316,4 @@ BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 permission_restrictions_from_pg babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/13_8/schedule b/test/JDBC/upgrade/13_8/schedule index c5cb7a6b55..3cd8f0f87d 100644 --- a/test/JDBC/upgrade/13_8/schedule +++ b/test/JDBC/upgrade/13_8/schedule @@ -316,3 +316,4 @@ BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 permission_restrictions_from_pg babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql b/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql index 2c26bacb22..e4954671df 100644 --- a/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql +++ b/test/JDBC/upgrade/13_9/preparation/sys-columns-dep-vu-prepare.sql @@ -2,11 +2,11 @@ create table sys_columns_dep_vu_prepare_t1(a int, b float, c bigint, d numeric, go create procedure sys_columns_dep_vu_prepare_p1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by name; go create view sys_columns_dep_vu_prepare_v1 as - select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1'); + select name, column_id, precision, scale from sys.columns where object_id=OBJECT_ID('sys_columns_dep_vu_prepare_t1') order by name; go create function sys_columns_dep_vu_prepare_f1() diff --git a/test/JDBC/upgrade/13_9/schedule b/test/JDBC/upgrade/13_9/schedule index d907b89218..76f85ec60a 100644 --- a/test/JDBC/upgrade/13_9/schedule +++ b/test/JDBC/upgrade/13_9/schedule @@ -316,3 +316,4 @@ BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 permission_restrictions_from_pg babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/14_10/schedule b/test/JDBC/upgrade/14_10/schedule index 9f528464ad..fc8ddc251d 100644 --- a/test/JDBC/upgrade/14_10/schedule +++ b/test/JDBC/upgrade/14_10/schedule @@ -175,7 +175,7 @@ babelfish_authid_user_ext babelfish_inconsistent_metadata babelfish_migration_mode schema_resolution_func -BABEL-3147 +BABEL-3147-before-16_3-or-15_7-or-14_12 collation_tests_arabic collation_tests_greek collation_tests_mongolian @@ -423,4 +423,5 @@ babel-4475 BABEL-4606 babel-4517 BABEL_4553 -BABEL_4817 \ No newline at end of file +BABEL-4641-before-16_3-or-15_7-or-14_12 +BABEL_4817 diff --git a/test/JDBC/upgrade/14_11/schedule b/test/JDBC/upgrade/14_11/schedule index 989c32a4c3..96f4d0c279 100644 --- a/test/JDBC/upgrade/14_11/schedule +++ b/test/JDBC/upgrade/14_11/schedule @@ -174,7 +174,7 @@ babelfish_authid_user_ext babelfish_inconsistent_metadata babelfish_migration_mode schema_resolution_func -BABEL-3147 +BABEL-3147-before-16_3-or-15_7-or-14_12 collation_tests_arabic collation_tests_greek collation_tests_mongolian @@ -421,4 +421,5 @@ sys_database_permissions babel-4475 BABEL-4606 babel-4517 -BABEL_4817 \ No newline at end of file +BABEL-4641-before-16_3-or-15_7-or-14_12 +BABEL_4817 diff --git a/test/JDBC/upgrade/14_3/schedule b/test/JDBC/upgrade/14_3/schedule index 661e6eb6fc..9ca2ac8e28 100644 --- a/test/JDBC/upgrade/14_3/schedule +++ b/test/JDBC/upgrade/14_3/schedule @@ -329,3 +329,4 @@ BABEL-4410 AUTO_ANALYZE-before-15-5-or-14-10 permission_restrictions_from_pg babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/14_5/schedule b/test/JDBC/upgrade/14_5/schedule index b339d4d0f2..50c24a1e3c 100644 --- a/test/JDBC/upgrade/14_5/schedule +++ b/test/JDBC/upgrade/14_5/schedule @@ -155,7 +155,7 @@ babelfish_inconsistent_metadata babelfish_migration_mode schema_resolution_func select-strip-parens-before-14-10 -BABEL-3147 +BABEL-3147-before-16_3-or-15_7-or-14_12 collation_tests_arabic collation_tests_greek collation_tests_mongolian @@ -342,3 +342,4 @@ AUTO_ANALYZE-before-15-5-or-14-10 BABEL_4389 permission_restrictions_from_pg babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/14_6/schedule b/test/JDBC/upgrade/14_6/schedule index 7f70a3c672..b5e5f80ddb 100644 --- a/test/JDBC/upgrade/14_6/schedule +++ b/test/JDBC/upgrade/14_6/schedule @@ -165,7 +165,7 @@ babelfish_authid_user_ext babelfish_inconsistent_metadata babelfish_migration_mode schema_resolution_func -BABEL-3147 +BABEL-3147-before-16_3-or-15_7-or-14_12 collation_tests_arabic collation_tests_greek collation_tests_mongolian @@ -368,3 +368,4 @@ BABEL_4330 AUTO_ANALYZE-before-15-5-or-14-10 BABEL_4389 babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/14_7/schedule b/test/JDBC/upgrade/14_7/schedule index 6dff30e1e4..fba56457ad 100644 --- a/test/JDBC/upgrade/14_7/schedule +++ b/test/JDBC/upgrade/14_7/schedule @@ -174,7 +174,7 @@ babelfish_authid_user_ext babelfish_inconsistent_metadata babelfish_migration_mode schema_resolution_func -BABEL-3147 +BABEL-3147-before-16_3-or-15_7-or-14_12 collation_tests_arabic collation_tests_greek collation_tests_mongolian @@ -410,3 +410,4 @@ BABEL_4330 AUTO_ANALYZE-before-15-5-or-14-10 BABEL_4389 babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 diff --git a/test/JDBC/upgrade/14_8/schedule b/test/JDBC/upgrade/14_8/schedule index 29e9800e92..10e26ba624 100644 --- a/test/JDBC/upgrade/14_8/schedule +++ b/test/JDBC/upgrade/14_8/schedule @@ -174,7 +174,7 @@ babelfish_authid_user_ext babelfish_inconsistent_metadata babelfish_migration_mode schema_resolution_func -BABEL-3147 +BABEL-3147-before-16_3-or-15_7-or-14_12 collation_tests_arabic collation_tests_greek collation_tests_mongolian @@ -411,4 +411,5 @@ AUTO_ANALYZE-before-15-5-or-14-10 BABEL_4389 BABEL-4606 babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 BABEL_4817 diff --git a/test/JDBC/upgrade/14_9/schedule b/test/JDBC/upgrade/14_9/schedule index b5f7a6daf1..3b867bdaee 100644 --- a/test/JDBC/upgrade/14_9/schedule +++ b/test/JDBC/upgrade/14_9/schedule @@ -174,7 +174,7 @@ babelfish_authid_user_ext babelfish_inconsistent_metadata babelfish_migration_mode schema_resolution_func -BABEL-3147 +BABEL-3147-before-16_3-or-15_7-or-14_12 collation_tests_arabic collation_tests_greek collation_tests_mongolian @@ -415,4 +415,5 @@ AUTO_ANALYZE-before-15-5-or-14-10 babel-4475 BABEL-4606 babel-4517 +BABEL-4641-before-16_3-or-15_7-or-14_12 BABEL_4817 diff --git a/test/JDBC/upgrade/latest/schedule b/test/JDBC/upgrade/latest/schedule index ff4f7d3c06..ac85d0947b 100644 --- a/test/JDBC/upgrade/latest/schedule +++ b/test/JDBC/upgrade/latest/schedule @@ -424,5 +424,6 @@ babel-4475 sys_availability_groups sys_availability_replicas babel-4517 +BABEL-4641 BABEL-4707 BABEL_4817