From fb573f2701556bacf23acd78d8c312d70edee0ac Mon Sep 17 00:00:00 2001 From: Tanzeel Khan Date: Thu, 14 Dec 2023 06:29:45 +0000 Subject: [PATCH 1/5] fix typmod for sys binary Signed-off-by: Tanzeel Khan --- .github/workflows/upgrade-test.yml | 2 +- contrib/babelfishpg_common/sql/binary.sql | 5 + .../babelfish_common_helper--3.3.0--3.4.0.sql | 4 + contrib/babelfishpg_tsql/src/pltsql_coerce.c | 25 +- contrib/babelfishpg_tsql/src/pltsql_utils.c | 8 + contrib/babelfishpg_tsql/src/tsqlIface.cpp | 15 +- test/JDBC/expected/BABEL-1566-vu-verify.out | 2 +- test/JDBC/expected/BABEL-1566.out | 2 +- ...L-3166-before-14_11-or-15_6-vu-prepare.out | 43 +++ ...EL-3166-before-14_11-or-15_6-vu-verify.out | 38 +++ test/JDBC/expected/BABEL-3166-vu-prepare.out | 2 +- test/JDBC/expected/BABEL-3166-vu-verify.out | 2 +- test/JDBC/expected/BABEL_1940.out | 2 +- test/JDBC/expected/BABEL_4544.out | 280 ++++++++++++++++++ ...Binary-before-14_11-or-15_6-vu-cleanup.out | 4 + ...Binary-before-14_11-or-15_6-vu-prepare.out | 33 +++ ...tBinary-before-14_11-or-15_6-vu-verify.out | 28 ++ test/JDBC/expected/TestBinary-vu-prepare.out | 2 +- test/JDBC/expected/TestBinary.out | 2 +- test/JDBC/expected/babel_datatype.out | 6 +- test/JDBC/expected/binary-index-vu-verify.out | 12 +- test/JDBC/expected/openquery-vu-verify.out | 2 +- ...L-3166-before-14_11-or-15_6-vu-prepare.sql | 23 ++ ...EL-3166-before-14_11-or-15_6-vu-verify.sql | 18 ++ test/JDBC/input/BABEL_4544.sql | 94 ++++++ ...Binary-before-14_11-or-15_6-vu-cleanup.txt | 4 + ...Binary-before-14_11-or-15_6-vu-prepare.txt | 17 ++ ...tBinary-before-14_11-or-15_6-vu-verify.txt | 4 + .../input/datatypes/TestBinary-vu-prepare.txt | 2 +- test/JDBC/input/datatypes/TestBinary.txt | 2 +- test/JDBC/jdbc_schedule | 5 + test/JDBC/upgrade/13_4/schedule | 4 +- test/JDBC/upgrade/13_5/schedule | 4 +- test/JDBC/upgrade/13_6/schedule | 4 +- test/JDBC/upgrade/13_7/schedule | 4 +- test/JDBC/upgrade/13_8/schedule | 4 +- test/JDBC/upgrade/13_9/schedule | 4 +- test/JDBC/upgrade/14_10/schedule | 4 +- test/JDBC/upgrade/14_11/schedule | 4 +- test/JDBC/upgrade/14_3/schedule | 4 +- test/JDBC/upgrade/14_5/schedule | 4 +- test/JDBC/upgrade/14_6/schedule | 4 +- test/JDBC/upgrade/14_7/schedule | 4 +- test/JDBC/upgrade/14_8/schedule | 4 +- test/JDBC/upgrade/14_9/schedule | 4 +- test/JDBC/upgrade/15_1/schedule | 4 +- test/JDBC/upgrade/15_2/schedule | 4 +- test/JDBC/upgrade/15_3/schedule | 4 +- test/JDBC/upgrade/15_4/schedule | 4 +- test/JDBC/upgrade/15_5/schedule | 4 +- 50 files changed, 700 insertions(+), 64 deletions(-) create mode 100644 test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-prepare.out create mode 100644 test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-verify.out create mode 100644 test/JDBC/expected/BABEL_4544.out create mode 100644 test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out create mode 100644 test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out create mode 100644 test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out create mode 100644 test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-prepare.sql create mode 100644 test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-verify.sql create mode 100644 test/JDBC/input/BABEL_4544.sql create mode 100644 test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt create mode 100644 test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt create mode 100644 test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt diff --git a/.github/workflows/upgrade-test.yml b/.github/workflows/upgrade-test.yml index aa3f3dcb58..d933c85612 100644 --- a/.github/workflows/upgrade-test.yml +++ b/.github/workflows/upgrade-test.yml @@ -121,7 +121,7 @@ jobs: done - name: Upload Logs - if: always() && steps.test-file-rename.outcome == 'success' + if: always() && steps.upgrade-and-test.outcome != 'success' uses: actions/upload-artifact@v2 with: name: upgrade-logs-${{ matrix.upgrade-path.title }} diff --git a/contrib/babelfishpg_common/sql/binary.sql b/contrib/babelfishpg_common/sql/binary.sql index 98e0b425e4..0ddd5cbc4b 100644 --- a/contrib/babelfishpg_common/sql/binary.sql +++ b/contrib/babelfishpg_common/sql/binary.sql @@ -46,6 +46,11 @@ CREATE TYPE sys.BBF_BINARY ( COLLATABLE = false ); +CREATE OR REPLACE FUNCTION sys.varbinarybinary (sys.BBF_VARBINARY, integer, boolean) +RETURNS sys.BBF_BINARY +AS 'babelfishpg_common', 'binary' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + CREATE CAST (sys.BBF_BINARY AS sys.BBF_VARBINARY) WITHOUT FUNCTION AS IMPLICIT; diff --git a/contrib/babelfishpg_common/sql/upgrades/babelfish_common_helper--3.3.0--3.4.0.sql b/contrib/babelfishpg_common/sql/upgrades/babelfish_common_helper--3.3.0--3.4.0.sql index 08b39c926f..2fdbe9e915 100644 --- a/contrib/babelfishpg_common/sql/upgrades/babelfish_common_helper--3.3.0--3.4.0.sql +++ b/contrib/babelfishpg_common/sql/upgrades/babelfish_common_helper--3.3.0--3.4.0.sql @@ -7,6 +7,10 @@ SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); +CREATE OR REPLACE FUNCTION sys.varbinarybinary (sys.BBF_VARBINARY, integer, boolean) +RETURNS sys.BBF_BINARY +AS 'babelfishpg_common', 'binary' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; -- Reset search_path to not affect any subsequent scripts SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false); diff --git a/contrib/babelfishpg_tsql/src/pltsql_coerce.c b/contrib/babelfishpg_tsql/src/pltsql_coerce.c index 5b945cf993..e555cfeca5 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_coerce.c +++ b/contrib/babelfishpg_tsql/src/pltsql_coerce.c @@ -47,6 +47,8 @@ extern coerce_string_literal_hook_type coerce_string_literal_hook; extern select_common_type_hook_type select_common_type_hook; extern select_common_typmod_hook_type select_common_typmod_hook; +extern bool babelfish_dump_restore; + PG_FUNCTION_INFO_V1(init_tsql_coerce_hash_tab); PG_FUNCTION_INFO_V1(init_tsql_datatype_precedence_hash_tab); @@ -111,7 +113,7 @@ tsql_cast_raw_info_t tsql_cast_raw_infos[] = {PG_CAST_ENTRY, "sys", "bbf_varbinary", "pg_catalog", "int4", NULL, 'i', 'f'}, {PG_CAST_ENTRY, "sys", "bbf_varbinary", "pg_catalog", "int2", NULL, 'i', 'f'}, {TSQL_CAST_ENTRY, "sys", "bbf_varbinary", "sys", "rowversion", "varbinaryrowversion", 'i', 'f'}, - {TSQL_CAST_WITHOUT_FUNC_ENTRY, "sys", "bbf_varbinary", "sys", "bbf_binary", NULL, 'i', 'b'}, + {TSQL_CAST_ENTRY, "sys", "bbf_varbinary", "sys", "bbf_binary", "varbinarybinary", 'i', 'f'}, /* binary {only allow to cast to integral data type) */ {PG_CAST_ENTRY, "sys", "bbf_binary", "pg_catalog", "int8", NULL, 'i', 'f'}, {PG_CAST_ENTRY, "sys", "bbf_binary", "pg_catalog", "int4", NULL, 'i', 'f'}, @@ -638,9 +640,26 @@ init_tsql_coerce_hash_tab(PG_FUNCTION_ARGS) if (!OidIsValid(entry->castfunc)) { + /* + * varbinary to binary implicit type cast without function should be allowed during MVU + * since the cast function might not exists when source version is before 14_11 and 15_6 + */ + if (babelfish_dump_restore && ((*common_utility_plugin_ptr->is_tsql_varbinary_datatype) (castsource) + && (*common_utility_plugin_ptr->is_tsql_binary_datatype) (casttarget))) + { + entry->castfunc = 0; + entry->castcontext = COERCION_CODE_IMPLICIT; + entry->castmethod = COERCION_METHOD_BINARY; + value = hash_search(ht_tsql_cast_info, key, HASH_ENTER, NULL); + *(tsql_cast_info_entry_t *) value = *entry; + continue; + } /* function is not loaded. wait for next scan */ - inited_ht_tsql_cast_info = false; - continue; + else + { + inited_ht_tsql_cast_info = false; + continue; + } } } break; diff --git a/contrib/babelfishpg_tsql/src/pltsql_utils.c b/contrib/babelfishpg_tsql/src/pltsql_utils.c index b5bc18d549..2413c2da6e 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_utils.c +++ b/contrib/babelfishpg_tsql/src/pltsql_utils.c @@ -38,6 +38,8 @@ bool is_tsql_any_char_datatype(Oid oid); /* sys.char / sys.nchar / * sys.varchar / sys.nvarchar */ bool is_tsql_text_ntext_or_image_datatype(Oid oid); +bool is_tsql_binary_or_varbinary_datatype(Oid oid); + bool pltsql_createFunction(ParseState *pstate, PlannedStmt *pstmt, const char *queryString, ProcessUtilityContext context, ParamListInfo params); @@ -1082,6 +1084,12 @@ is_tsql_text_ntext_or_image_datatype(Oid oid) (*common_utility_plugin_ptr->is_tsql_image_datatype) (oid); } +bool is_tsql_binary_or_varbinary_datatype(Oid oid) +{ + return (*common_utility_plugin_ptr->is_tsql_sys_binary_datatype) (oid) || + (*common_utility_plugin_ptr->is_tsql_sys_varbinary_datatype) (oid); +} + /* * Try to acquire a lock with no wait */ diff --git a/contrib/babelfishpg_tsql/src/tsqlIface.cpp b/contrib/babelfishpg_tsql/src/tsqlIface.cpp index 3c560021c6..10c61fca00 100644 --- a/contrib/babelfishpg_tsql/src/tsqlIface.cpp +++ b/contrib/babelfishpg_tsql/src/tsqlIface.cpp @@ -66,6 +66,7 @@ extern "C" extern PLtsql_type *parse_datatype(const char *string, int location); extern bool is_tsql_any_char_datatype(Oid oid); extern bool is_tsql_text_ntext_or_image_datatype(Oid oid); + extern bool is_tsql_binary_or_varbinary_datatype(Oid oid); extern int CurrentLineNumber; @@ -4558,9 +4559,12 @@ makeDeclareStmt(TSqlParser::Declare_statementContext *ctx, std::mapatttypmod == -1 && is_tsql_any_char_datatype(type->typoid)) + + /* (N)(VAR)CHAR and BINARY datatype length is treated as 1 when nothing is provided */ + if (type->atttypmod == -1 && (is_tsql_any_char_datatype(type->typoid) + || is_tsql_binary_or_varbinary_datatype(type->typoid))) { - std::string newTypeStr = typeStr + "(1)"; /* in T-SQL, length-less (N)(VAR)CHAR's length is treated as 1 */ + std::string newTypeStr = typeStr + "(1)"; type = parse_datatype(newTypeStr.c_str(), 0); } @@ -4589,9 +4593,12 @@ makeDeclareStmt(TSqlParser::Declare_statementContext *ctx, std::mapdata_type()); PLtsql_type *type = parse_datatype(typeStr.c_str(), 0); // FIXME: the second arg should be 'location' - if (type->atttypmod == -1 && is_tsql_any_char_datatype(type->typoid)) + + /* (N)(VAR)CHAR and BINARY datatype length is treated as 1 when nothing is provided */ + if (type->atttypmod == -1 && (is_tsql_any_char_datatype(type->typoid) + || is_tsql_binary_or_varbinary_datatype(type->typoid))) { - std::string newTypeStr = typeStr + "(1)"; /* in T-SQL, length-less (N)(VAR)CHAR's length is treated as 1 */ + std::string newTypeStr = typeStr + "(1)"; type = parse_datatype(newTypeStr.c_str(), 0); } else if (is_tsql_text_ntext_or_image_datatype(type->typoid)) diff --git a/test/JDBC/expected/BABEL-1566-vu-verify.out b/test/JDBC/expected/BABEL-1566-vu-verify.out index 035f9f727d..311cb53594 100644 --- a/test/JDBC/expected/BABEL-1566-vu-verify.out +++ b/test/JDBC/expected/BABEL-1566-vu-verify.out @@ -281,7 +281,7 @@ select cast(cast(0xfe as binary) as text); go ~~START~~ text -0xfe +0xfe0000000000000000000000000000000000000000000000000000000000 ~~END~~ diff --git a/test/JDBC/expected/BABEL-1566.out b/test/JDBC/expected/BABEL-1566.out index c61c0da56f..2a08c99065 100644 --- a/test/JDBC/expected/BABEL-1566.out +++ b/test/JDBC/expected/BABEL-1566.out @@ -344,7 +344,7 @@ select cast(cast(0xfe as binary) as text); go ~~START~~ text -0xfe +0xfe0000000000000000000000000000000000000000000000000000000000 ~~END~~ diff --git a/test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-prepare.out b/test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-prepare.out new file mode 100644 index 0000000000..90e274de21 --- /dev/null +++ b/test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-prepare.out @@ -0,0 +1,43 @@ +-- function +CREATE FUNCTION babel_3166_func(@a numeric, @b varchar, @c varchar(max), @d varchar(8), @e binary(6)) +RETURNS varbinary(8) AS BEGIN RETURN @e END; +go + +-- Look at the probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_func'; +go +~~START~~ +varchar#!#text +babel_3166_func#!#{"version_num": "1", "typmod_array": ["1179652", "-1", "-8000", "8", "6", "8"], "original_probin": ""} +~~END~~ + + +SELECT babel_3166_func(1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe); +go +~~START~~ +varbinary +12BCFE +~~END~~ + + +-- procedure +CREATE PROCEDURE babel_3166_proc @a numeric, @b varchar, @c varchar(max), @d varchar(8), @e binary(6) +AS SELECT @e; +go + +-- Look at the probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_proc'; +go +~~START~~ +varchar#!#text +babel_3166_proc#!#{"version_num": "1", "typmod_array": ["1179652", "-1", "-8000", "8", "6"], "original_probin": ""} +~~END~~ + + +EXEC babel_3166_proc 1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe; +go +~~START~~ +binary +12BCFE000000 +~~END~~ + diff --git a/test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-verify.out b/test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-verify.out new file mode 100644 index 0000000000..caea907f24 --- /dev/null +++ b/test/JDBC/expected/BABEL-3166-before-14_11-or-15_6-vu-verify.out @@ -0,0 +1,38 @@ +-- Look at function's probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_func'; +go +~~START~~ +varchar#!#text +babel_3166_func#!#{"version_num": "1", "typmod_array": ["1179652", "-1", "-8000", "8", "6", "8"], "original_probin": ""} +~~END~~ + + +SELECT babel_3166_func(1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe); +go +~~START~~ +varbinary +12BCFE000000 +~~END~~ + + + +DROP FUNCTION babel_3166_func; +-- Look at procedures's probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_proc'; +go +~~START~~ +varchar#!#text +babel_3166_proc#!#{"version_num": "1", "typmod_array": ["1179652", "-1", "-8000", "8", "6"], "original_probin": ""} +~~END~~ + + +EXEC babel_3166_proc 1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe; +go +~~START~~ +binary +12BCFE000000 +~~END~~ + + +DROP PROCEDURE babel_3166_proc; +go diff --git a/test/JDBC/expected/BABEL-3166-vu-prepare.out b/test/JDBC/expected/BABEL-3166-vu-prepare.out index 90e274de21..482bcce97e 100644 --- a/test/JDBC/expected/BABEL-3166-vu-prepare.out +++ b/test/JDBC/expected/BABEL-3166-vu-prepare.out @@ -16,7 +16,7 @@ SELECT babel_3166_func(1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe); go ~~START~~ varbinary -12BCFE +12BCFE000000 ~~END~~ diff --git a/test/JDBC/expected/BABEL-3166-vu-verify.out b/test/JDBC/expected/BABEL-3166-vu-verify.out index 9a44eeb924..caea907f24 100644 --- a/test/JDBC/expected/BABEL-3166-vu-verify.out +++ b/test/JDBC/expected/BABEL-3166-vu-verify.out @@ -11,7 +11,7 @@ SELECT babel_3166_func(1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe); go ~~START~~ varbinary -12BCFE +12BCFE000000 ~~END~~ diff --git a/test/JDBC/expected/BABEL_1940.out b/test/JDBC/expected/BABEL_1940.out index 799aa22457..cae4ddbfb9 100644 --- a/test/JDBC/expected/BABEL_1940.out +++ b/test/JDBC/expected/BABEL_1940.out @@ -276,7 +276,7 @@ SELECT CAST(CAST(0x61 AS BINARY(3)) AS VARBINARY(2)) GO ~~START~~ varbinary -61 +6100 ~~END~~ diff --git a/test/JDBC/expected/BABEL_4544.out b/test/JDBC/expected/BABEL_4544.out new file mode 100644 index 0000000000..1f877593c3 --- /dev/null +++ b/test/JDBC/expected/BABEL_4544.out @@ -0,0 +1,280 @@ +SELECT DATALENGTH(CAST(0X61626364 AS BINARY(3))) +GO +~~START~~ +int +3 +~~END~~ + +SELECT DATALENGTH(CAST(0X6162 AS BINARY(3))) +GO +~~START~~ +int +3 +~~END~~ + +SELECT CAST(0x6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 AS BINARY) +GO +~~START~~ +binary +616161616161616161616161616161616161616161616161616161616161 +~~END~~ + +SELECT CAST(0x6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 AS BINARY(51)) +GO +~~START~~ +binary +616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616100 +~~END~~ + +SELECT DATALENGTH(CAST(CAST(0x11 AS VARBINARY(5)) AS BINARY(5))), CAST(CAST(0x11 AS VARBINARY(5)) AS BINARY(5)) +GO +~~START~~ +int#!#binary +5#!#1100000000 +~~END~~ + +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS VARBINARY(5)) AS BINARY(5))), CAST(CAST(0x111213141516 AS VARBINARY(5)) AS BINARY(5)) +GO +~~START~~ +int#!#binary +5#!#1112131415 +~~END~~ + +SELECT DATALENGTH(CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(5))), CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(5)) +GO +~~START~~ +int#!#varbinary +5#!#1100000000 +~~END~~ + +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(5))), CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(5)) +GO +~~START~~ +int#!#varbinary +5#!#1112131415 +~~END~~ + + +CREATE TABLE babel_4544_t (id BINARY(5)) +GO + +INSERT INTO babel_4544_t VALUES (0x65), (0x656667) +GO +~~ROW COUNT: 2~~ + +INSERT INTO babel_4544_t VALUES (0x6566676869707172) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: String or binary data would be truncated. +The statement has been terminated.)~~ + +INSERT INTO babel_4544_t VALUES (CAST(0x6566676869707172 AS VARBINARY(6))) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: String or binary data would be truncated. +The statement has been terminated.)~~ + +INSERT INTO babel_4544_t VALUES ('aa') +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: cannot coerce string literal to binary datatype)~~ + +INSERT INTO babel_4544_t VALUES (CAST('aaaaaa' AS VARBINARY)) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: String or binary data would be truncated. +The statement has been terminated.)~~ + +INSERT INTO babel_4544_t VALUES (CAST('aaa' AS VARBINARY)) +GO +~~ROW COUNT: 1~~ + +INSERT INTO babel_4544_t VALUES (CAST(0x65 AS VARBINARY)), (CAST(0x6564 AS VARBINARY(5))), (CAST(0x6566676869707172 AS VARBINARY(4))), (CAST(0x65666768 AS VARBINARY(6))) +GO +~~ROW COUNT: 4~~ + + +SELECT *, DATALENGTH(id) FROM babel_4544_t +GO +~~START~~ +binary#!#int +6500000000#!#5 +6566670000#!#5 +6161610000#!#5 +6500000000#!#5 +6564000000#!#5 +6566676800#!#5 +6566676800#!#5 +~~END~~ + + +DROP TABLE babel_4544_t +GO + +-- default length should be 1 +DECLARE @A VARBINARY = 0x0123456789012345678901234567890123456789 +SELECT @A, DATALENGTH(@A) +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)), CAST(@A as VARBINARY(60)) +GO +~~START~~ +varbinary#!#int +01#!#1 +~~END~~ + +~~START~~ +int#!#binary#!#varbinary +50#!#0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#!#01 +~~END~~ + + +DECLARE @A BINARY = 0x0123456789012345678901234567890123456789 +SELECT @A, DATALENGTH(@A) +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO +~~START~~ +binary#!#int +01#!#1 +~~END~~ + +~~START~~ +int#!#binary +50#!#0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @A BINARY = 0x012345678901234567890123456789012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO +~~START~~ +int#!#binary +1#!#01 +~~END~~ + +~~START~~ +int#!#binary +50#!#0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @A BINARY = 0x01234567890123456789012345678901234567890123456789012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO +~~START~~ +int#!#binary +1#!#01 +~~END~~ + +~~START~~ +int#!#binary +50#!#0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @A BINARY(10) = 0x012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO +~~START~~ +int#!#binary +10#!#01234567890123456789 +~~END~~ + +~~START~~ +int#!#binary +50#!#0123456789012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @A BINARY(10) = 0x01234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO +~~START~~ +int#!#binary +10#!#01234567890123456789 +~~END~~ + +~~START~~ +int#!#binary +50#!#0123456789012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +DECLARE @A BINARY(10) = 0x0123456789012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO +~~START~~ +int#!#binary +10#!#01234567890123456789 +~~END~~ + +~~START~~ +int#!#binary +50#!#0123456789012345678900000000000000000000000000000000000000000000000000000000000000000000000000000000 +~~END~~ + + +SELECT DATALENGTH(CAST(CAST(0x11 AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(0x11 AS VARBINARY(MAX)) AS BINARY(5)) +GO +~~START~~ +int#!#binary +5#!#1100000000 +~~END~~ + +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(0x111213141516 AS VARBINARY(MAX)) AS BINARY(5)) +GO +~~START~~ +int#!#binary +5#!#1112131415 +~~END~~ + +SELECT DATALENGTH(CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(MAX)) +GO +~~START~~ +int#!#varbinary +5#!#1100000000 +~~END~~ + +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(MAX)) +GO +~~START~~ +int#!#varbinary +5#!#1112131415 +~~END~~ + + +SELECT DATALENGTH(CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5)) +GO +~~START~~ +int#!#binary +#!# +~~END~~ + +SELECT DATALENGTH(CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5)) +GO +~~START~~ +int#!#binary +#!# +~~END~~ + +SELECT DATALENGTH(CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX)) +GO +~~START~~ +int#!#varbinary +#!# +~~END~~ + +SELECT DATALENGTH(CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX)) +GO +~~START~~ +int#!#varbinary +#!# +~~END~~ + diff --git a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out new file mode 100644 index 0000000000..e3c1b0f3f7 --- /dev/null +++ b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out @@ -0,0 +1,4 @@ +DROP TABLE testBINARY_dt1 +DROP TABLE testBINARY_dt2 +DROP TABLE testBINARY_dt3 +DROP TABLE testBINARY_dt4 diff --git a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out new file mode 100644 index 0000000000..35de0cfd73 --- /dev/null +++ b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out @@ -0,0 +1,33 @@ +CREATE TABLE testBINARY_dt1(a BINARY(8), b VARBINARY(10)); +#inserting random values +INSERT INTO testBINARY_dt1(a, b) values (1234, 12345); +~~ROW COUNT: 1~~ + +INSERT INTO testBINARY_dt1(a, b) values (NULL, NULL); +~~ROW COUNT: 1~~ + +#INSERT INTO testBINARY_dt1(a, b) values (0x31323334, 0x3132333435); + +CREATE TABLE testBINARY_dt2(a VARBINARY(max)); +INSERT INTO testBINARY_dt2(a) values (NULL); +~~ROW COUNT: 1~~ + + +create table testBINARY_dt3 (a VARBINARY(max), b int, c int, d int, e int ,f int, g int, h int, i int); +insert into testBINARY_dt3 (a,b,c,d,e,f,g,h,i) values (NULL,1,2,3,4,5,6,7,8); +~~ROW COUNT: 1~~ + + +CREATE TABLE testBINARY_dt4(a BINARY(8), b VARBINARY(10)); +INSERT INTO testBINARY_dt4(a, b) values (1234, 12345); +~~ROW COUNT: 1~~ + +prepst#!# INSERT INTO testBINARY_dt4(a, b) values(?, ?) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 +~~ROW COUNT: 1~~ + +prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 +~~ROW COUNT: 1~~ + diff --git a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out new file mode 100644 index 0000000000..12ad105ab3 --- /dev/null +++ b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out @@ -0,0 +1,28 @@ +SELECT * FROM testBINARY_dt1 +~~START~~ +binary#!#varbinary +00000000000004D2#!#00003039 +#!# +~~END~~ + +SELECT * FROM testBINARY_dt2 +~~START~~ +varbinary + +~~END~~ + +SELECT * FROM testBINARY_dt3 +~~START~~ +varbinary#!#int#!#int#!#int#!#int#!#int#!#int#!#int#!#int +#!#1#!#2#!#3#!#4#!#5#!#6#!#7#!#8 +~~END~~ + +SELECT * FROM testBINARY_dt4 +~~START~~ +binary#!#varbinary +00000000000004D2#!#00003039 +3132333400000000#!#3132333435 +3132333435363738#!#3132333435 +3132333400000000#!#313233343536373839 +~~END~~ + diff --git a/test/JDBC/expected/TestBinary-vu-prepare.out b/test/JDBC/expected/TestBinary-vu-prepare.out index 35de0cfd73..031ec16154 100644 --- a/test/JDBC/expected/TestBinary-vu-prepare.out +++ b/test/JDBC/expected/TestBinary-vu-prepare.out @@ -25,7 +25,7 @@ INSERT INTO testBINARY_dt4(a, b) values (1234, 12345); prepst#!# INSERT INTO testBINARY_dt4(a, b) values(?, ?) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 ~~ROW COUNT: 1~~ -prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 +prepst#!#exec#!#binary|-|a|-|12345678#!#varbinary|-|b|-|12345 ~~ROW COUNT: 1~~ prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 diff --git a/test/JDBC/expected/TestBinary.out b/test/JDBC/expected/TestBinary.out index 85a5ac131f..562c8b0cea 100644 --- a/test/JDBC/expected/TestBinary.out +++ b/test/JDBC/expected/TestBinary.out @@ -49,7 +49,7 @@ INSERT INTO BINARY_dt(a, b) values (1234, 12345); prepst#!# INSERT INTO BINARY_dt(a, b) values(?, ?) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 ~~ROW COUNT: 1~~ -prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 +prepst#!#exec#!#binary|-|a|-|12345678#!#varbinary|-|b|-|12345 ~~ROW COUNT: 1~~ prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 diff --git a/test/JDBC/expected/babel_datatype.out b/test/JDBC/expected/babel_datatype.out index cce059dcac..d571a2b4c4 100644 --- a/test/JDBC/expected/babel_datatype.out +++ b/test/JDBC/expected/babel_datatype.out @@ -2279,14 +2279,16 @@ GO insert into testing6 values (cast('ab' as varbinary)); GO -~~ROW COUNT: 1~~ +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: String or binary data would be truncated. +The statement has been terminated.)~~ select * from testing6; GO ~~START~~ binary 61 -61 ~~END~~ diff --git a/test/JDBC/expected/binary-index-vu-verify.out b/test/JDBC/expected/binary-index-vu-verify.out index a25e9eb03d..c3480843b2 100644 --- a/test/JDBC/expected/binary-index-vu-verify.out +++ b/test/JDBC/expected/binary-index-vu-verify.out @@ -62,7 +62,7 @@ Query Text: EXEC babel_3939_vu_prepare_p1 Index Cond: ((a)::bbf_binary = '0xbaadf00d'::bbf_varbinary) Query Text: select * from tab_binary where a = cast (0xBAADF00D as binary ) -> Index Scan using ix_tab_binary_atab_binary30474ea5eaee4ec0e0a5a86377abb1ac on tab_binary - Index Cond: ((a)::bbf_binary = '0xbaadf00d'::bbf_binary) + Index Cond: ((a)::bbf_binary = '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_binary) Query Text: select * from tab_binary where a = 0xBAADF00D -> Index Scan using ix_tab_binary_atab_binary30474ea5eaee4ec0e0a5a86377abb1ac on tab_binary Index Cond: ((a)::bbf_binary = '0xbaadf00d'::bbf_varbinary) @@ -95,19 +95,19 @@ Query Text: EXEC babel_3939_vu_prepare_p2 Index Cond: ((a)::bbf_varbinary = '0xbaadf00d'::bbf_varbinary) Query Text: select * from tab_varbinary where a = cast(0xBAADF00D as binary ) -> Index Scan using ix_tab_binary_btab_varbinary785ec2330c9a18520469e01cd1dc6f53 on tab_varbinary - Index Cond: ((a)::bbf_varbinary = '0xbaadf00d'::bbf_binary) + Index Cond: ((a)::bbf_varbinary = '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_binary) Query Text: select * from tab_varbinary where a > cast(0xBAADF00D as binary ) -> Seq Scan on tab_varbinary - Filter: ((a)::bbf_varbinary > '0xbaadf00d'::bbf_varbinary) + Filter: ((a)::bbf_varbinary > '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) Query Text: select * from tab_varbinary where a < cast(0xBAADF00D as binary ) -> Seq Scan on tab_varbinary - Filter: ((a)::bbf_varbinary < '0xbaadf00d'::bbf_varbinary) + Filter: ((a)::bbf_varbinary < '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) Query Text: select * from tab_varbinary where a >= cast(0xBAADF00D as binary ) -> Seq Scan on tab_varbinary - Filter: ((a)::bbf_varbinary >= '0xbaadf00d'::bbf_varbinary) + Filter: ((a)::bbf_varbinary >= '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) Query Text: select * from tab_varbinary where a <= cast(0xBAADF00D as binary ) -> Seq Scan on tab_varbinary - Filter: ((a)::bbf_varbinary <= '0xbaadf00d'::bbf_varbinary) + Filter: ((a)::bbf_varbinary <= '0xbaadf00d0000000000000000000000000000000000000000000000000000'::bbf_varbinary) ~~END~~ diff --git a/test/JDBC/expected/openquery-vu-verify.out b/test/JDBC/expected/openquery-vu-verify.out index e19d98d657..b14a6574d7 100644 --- a/test/JDBC/expected/openquery-vu-verify.out +++ b/test/JDBC/expected/openquery-vu-verify.out @@ -2093,7 +2093,7 @@ INSERT INTO testBINARY_dt4(a, b) values (1234, 12345); prepst#!# INSERT INTO testBINARY_dt4(a, b) values(?, ?) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 ~~ROW COUNT: 1~~ -prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 +prepst#!#exec#!#binary|-|a|-|12345678#!#varbinary|-|b|-|12345 ~~ROW COUNT: 1~~ prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 diff --git a/test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-prepare.sql b/test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-prepare.sql new file mode 100644 index 0000000000..16b17cb346 --- /dev/null +++ b/test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-prepare.sql @@ -0,0 +1,23 @@ +-- function +CREATE FUNCTION babel_3166_func(@a numeric, @b varchar, @c varchar(max), @d varchar(8), @e binary(6)) +RETURNS varbinary(8) AS BEGIN RETURN @e END; +go + +-- Look at the probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_func'; +go + +SELECT babel_3166_func(1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe); +go + +-- procedure +CREATE PROCEDURE babel_3166_proc @a numeric, @b varchar, @c varchar(max), @d varchar(8), @e binary(6) +AS SELECT @e; +go + +-- Look at the probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_proc'; +go + +EXEC babel_3166_proc 1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe; +go \ No newline at end of file diff --git a/test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-verify.sql b/test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-verify.sql new file mode 100644 index 0000000000..96d1019ab9 --- /dev/null +++ b/test/JDBC/input/BABEL-3166-before-14_11-or-15_6-vu-verify.sql @@ -0,0 +1,18 @@ +-- Look at function's probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_func'; +go + +SELECT babel_3166_func(1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe); +go + +DROP FUNCTION babel_3166_func; + +-- Look at procedures's probin for typmod information +SELECT proname, probin FROM pg_proc WHERE proname = 'babel_3166_proc'; +go + +EXEC babel_3166_proc 1.2, 'abc', 'abcd', 'abcdefgh', 0x12bcfe; +go + +DROP PROCEDURE babel_3166_proc; +go diff --git a/test/JDBC/input/BABEL_4544.sql b/test/JDBC/input/BABEL_4544.sql new file mode 100644 index 0000000000..3c8f4783c4 --- /dev/null +++ b/test/JDBC/input/BABEL_4544.sql @@ -0,0 +1,94 @@ +SELECT DATALENGTH(CAST(0X61626364 AS BINARY(3))) +GO +SELECT DATALENGTH(CAST(0X6162 AS BINARY(3))) +GO +SELECT CAST(0x6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 AS BINARY) +GO +SELECT CAST(0x6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 AS BINARY(51)) +GO +SELECT DATALENGTH(CAST(CAST(0x11 AS VARBINARY(5)) AS BINARY(5))), CAST(CAST(0x11 AS VARBINARY(5)) AS BINARY(5)) +GO +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS VARBINARY(5)) AS BINARY(5))), CAST(CAST(0x111213141516 AS VARBINARY(5)) AS BINARY(5)) +GO +SELECT DATALENGTH(CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(5))), CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(5)) +GO +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(5))), CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(5)) +GO + +CREATE TABLE babel_4544_t (id BINARY(5)) +GO + +INSERT INTO babel_4544_t VALUES (0x65), (0x656667) +GO +INSERT INTO babel_4544_t VALUES (0x6566676869707172) +GO +INSERT INTO babel_4544_t VALUES (CAST(0x6566676869707172 AS VARBINARY(6))) +GO +INSERT INTO babel_4544_t VALUES ('aa') +GO +INSERT INTO babel_4544_t VALUES (CAST('aaaaaa' AS VARBINARY)) +GO +INSERT INTO babel_4544_t VALUES (CAST('aaa' AS VARBINARY)) +GO +INSERT INTO babel_4544_t VALUES (CAST(0x65 AS VARBINARY)), (CAST(0x6564 AS VARBINARY(5))), (CAST(0x6566676869707172 AS VARBINARY(4))), (CAST(0x65666768 AS VARBINARY(6))) +GO + +SELECT *, DATALENGTH(id) FROM babel_4544_t +GO + +DROP TABLE babel_4544_t +GO + +-- default length should be 1 +DECLARE @A VARBINARY = 0x0123456789012345678901234567890123456789 +SELECT @A, DATALENGTH(@A) +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)), CAST(@A as VARBINARY(60)) +GO + +DECLARE @A BINARY = 0x0123456789012345678901234567890123456789 +SELECT @A, DATALENGTH(@A) +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO + +DECLARE @A BINARY = 0x012345678901234567890123456789012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO + +DECLARE @A BINARY = 0x01234567890123456789012345678901234567890123456789012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO + +DECLARE @A BINARY(10) = 0x012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO + +DECLARE @A BINARY(10) = 0x01234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO + +DECLARE @A BINARY(10) = 0x0123456789012345678901234567890123456789 +SELECT DATALENGTH(@A), @A +SELECT DATALENGTH(CAST(@A as BINARY(50))), CAST(@A as BINARY(50)) +GO + +SELECT DATALENGTH(CAST(CAST(0x11 AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(0x11 AS VARBINARY(MAX)) AS BINARY(5)) +GO +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(0x111213141516 AS VARBINARY(MAX)) AS BINARY(5)) +GO +SELECT DATALENGTH(CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(0x11 AS BINARY(5)) AS VARBINARY(MAX)) +GO +SELECT DATALENGTH(CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(0x111213141516 AS BINARY(5)) AS VARBINARY(MAX)) +GO + +SELECT DATALENGTH(CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5)) +GO +SELECT DATALENGTH(CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5))), CAST(CAST(NULL AS VARBINARY(MAX)) AS BINARY(5)) +GO +SELECT DATALENGTH(CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX)) +GO +SELECT DATALENGTH(CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX))), CAST(CAST(NULL AS BINARY(5)) AS VARBINARY(MAX)) +GO diff --git a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt new file mode 100644 index 0000000000..e3c1b0f3f7 --- /dev/null +++ b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt @@ -0,0 +1,4 @@ +DROP TABLE testBINARY_dt1 +DROP TABLE testBINARY_dt2 +DROP TABLE testBINARY_dt3 +DROP TABLE testBINARY_dt4 diff --git a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt new file mode 100644 index 0000000000..e020a18017 --- /dev/null +++ b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt @@ -0,0 +1,17 @@ +CREATE TABLE testBINARY_dt1(a BINARY(8), b VARBINARY(10)); +#inserting random values +INSERT INTO testBINARY_dt1(a, b) values (1234, 12345); +INSERT INTO testBINARY_dt1(a, b) values (NULL, NULL); +#INSERT INTO testBINARY_dt1(a, b) values (0x31323334, 0x3132333435); + +CREATE TABLE testBINARY_dt2(a VARBINARY(max)); +INSERT INTO testBINARY_dt2(a) values (NULL); + +create table testBINARY_dt3 (a VARBINARY(max), b int, c int, d int, e int ,f int, g int, h int, i int); +insert into testBINARY_dt3 (a,b,c,d,e,f,g,h,i) values (NULL,1,2,3,4,5,6,7,8); + +CREATE TABLE testBINARY_dt4(a BINARY(8), b VARBINARY(10)); +INSERT INTO testBINARY_dt4(a, b) values (1234, 12345); +prepst#!# INSERT INTO testBINARY_dt4(a, b) values(@a, @b) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 +prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 +prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 \ No newline at end of file diff --git a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt new file mode 100644 index 0000000000..530fa79de6 --- /dev/null +++ b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt @@ -0,0 +1,4 @@ +SELECT * FROM testBINARY_dt1 +SELECT * FROM testBINARY_dt2 +SELECT * FROM testBINARY_dt3 +SELECT * FROM testBINARY_dt4 \ No newline at end of file diff --git a/test/JDBC/input/datatypes/TestBinary-vu-prepare.txt b/test/JDBC/input/datatypes/TestBinary-vu-prepare.txt index e020a18017..29cad2a451 100644 --- a/test/JDBC/input/datatypes/TestBinary-vu-prepare.txt +++ b/test/JDBC/input/datatypes/TestBinary-vu-prepare.txt @@ -13,5 +13,5 @@ insert into testBINARY_dt3 (a,b,c,d,e,f,g,h,i) values (NULL,1,2,3,4,5,6,7,8); CREATE TABLE testBINARY_dt4(a BINARY(8), b VARBINARY(10)); INSERT INTO testBINARY_dt4(a, b) values (1234, 12345); prepst#!# INSERT INTO testBINARY_dt4(a, b) values(@a, @b) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 -prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 +prepst#!#exec#!#binary|-|a|-|12345678#!#varbinary|-|b|-|12345 prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 \ No newline at end of file diff --git a/test/JDBC/input/datatypes/TestBinary.txt b/test/JDBC/input/datatypes/TestBinary.txt index 0d2ffb1207..e4f4c5a539 100644 --- a/test/JDBC/input/datatypes/TestBinary.txt +++ b/test/JDBC/input/datatypes/TestBinary.txt @@ -21,7 +21,7 @@ drop table BINARY_dt; CREATE TABLE BINARY_dt(a BINARY(8), b VARBINARY(10)); INSERT INTO BINARY_dt(a, b) values (1234, 12345); prepst#!# INSERT INTO BINARY_dt(a, b) values(@a, @b) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 -prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 +prepst#!#exec#!#binary|-|a|-|12345678#!#varbinary|-|b|-|12345 prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 SELECT * FROM BINARY_dt; DROP TABLE BINARY_dt; diff --git a/test/JDBC/jdbc_schedule b/test/JDBC/jdbc_schedule index 2e8fd2a2c7..f9f28a83f7 100644 --- a/test/JDBC/jdbc_schedule +++ b/test/JDBC/jdbc_schedule @@ -96,6 +96,11 @@ ignore#!#orderby-before-15_3-vu-verify ignore#!#orderby-before-15_3-vu-cleanup ignore#!#babel_function_string-before-15-5-or-14-10-vu-prepare ignore#!#babel_function_string-before-15-5-or-14-10-vu-verify +ignore#!#BABEL-3166-before-14_11-or-15_6-vu-prepare +ignore#!#BABEL-3166-before-14_11-or-15_6-vu-verify +ignore#!#TestBinary-before-14_11-or-15_6-vu-prepare +ignore#!#TestBinary-before-14_11-or-15_6-vu-verify +ignore#!#TestBinary-before-14_11-or-15_6-vu-cleanup # These tests are meant for upgrade scenario where source version is 13_X ignore#!#sys_database_principals_dep_for_13_x-vu-cleanup diff --git a/test/JDBC/upgrade/13_4/schedule b/test/JDBC/upgrade/13_4/schedule index 802400bc3f..40815d6ece 100644 --- a/test/JDBC/upgrade/13_4/schedule +++ b/test/JDBC/upgrade/13_4/schedule @@ -42,7 +42,7 @@ BABEL-3000-dep BABEL-3010-before-14_6 BABEL-3121 BABEL-3147-before-14_5 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3213 BABEL-3215 @@ -178,7 +178,7 @@ sys-views-dep tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar TestDate diff --git a/test/JDBC/upgrade/13_5/schedule b/test/JDBC/upgrade/13_5/schedule index b2c9e5df3d..39bae05db1 100644 --- a/test/JDBC/upgrade/13_5/schedule +++ b/test/JDBC/upgrade/13_5/schedule @@ -44,7 +44,7 @@ BABEL-3000-dep BABEL-3010-before-14_6 BABEL-3121 BABEL-3147-before-14_5 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -228,7 +228,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_6/schedule b/test/JDBC/upgrade/13_6/schedule index ba25064192..110753dd4c 100644 --- a/test/JDBC/upgrade/13_6/schedule +++ b/test/JDBC/upgrade/13_6/schedule @@ -57,7 +57,7 @@ BABEL-3116 BABEL-3118 BABEL-3121 BABEL-3147-before-14_5 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -281,7 +281,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_7/schedule b/test/JDBC/upgrade/13_7/schedule index e7634f4b39..2f3a830a3c 100644 --- a/test/JDBC/upgrade/13_7/schedule +++ b/test/JDBC/upgrade/13_7/schedule @@ -55,7 +55,7 @@ BABEL-3116 BABEL-3118 BABEL-3121 BABEL-3147-before-14_5 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -275,7 +275,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_8/schedule b/test/JDBC/upgrade/13_8/schedule index e7634f4b39..2f3a830a3c 100644 --- a/test/JDBC/upgrade/13_8/schedule +++ b/test/JDBC/upgrade/13_8/schedule @@ -55,7 +55,7 @@ BABEL-3116 BABEL-3118 BABEL-3121 BABEL-3147-before-14_5 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -275,7 +275,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_9/schedule b/test/JDBC/upgrade/13_9/schedule index a971b993b3..21234c1008 100644 --- a/test/JDBC/upgrade/13_9/schedule +++ b/test/JDBC/upgrade/13_9/schedule @@ -55,7 +55,7 @@ BABEL-3116 BABEL-3118 BABEL-3121 BABEL-3147-before-14_5 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -277,7 +277,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_10/schedule b/test/JDBC/upgrade/14_10/schedule index 0b1bb7ddba..cae56a168e 100644 --- a/test/JDBC/upgrade/14_10/schedule +++ b/test/JDBC/upgrade/14_10/schedule @@ -12,7 +12,7 @@ BABEL-3613 babelfish_cast_floor babel_try_parse TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar TestDatetime2 @@ -46,7 +46,7 @@ sys-suser_sid sys-trigger_events BABEL-2688 BABEL-328 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3221 BABEL-3204 diff --git a/test/JDBC/upgrade/14_11/schedule b/test/JDBC/upgrade/14_11/schedule index 0b1bb7ddba..cae56a168e 100644 --- a/test/JDBC/upgrade/14_11/schedule +++ b/test/JDBC/upgrade/14_11/schedule @@ -12,7 +12,7 @@ BABEL-3613 babelfish_cast_floor babel_try_parse TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar TestDatetime2 @@ -46,7 +46,7 @@ sys-suser_sid sys-trigger_events BABEL-2688 BABEL-328 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3221 BABEL-3204 diff --git a/test/JDBC/upgrade/14_3/schedule b/test/JDBC/upgrade/14_3/schedule index ee1b3f8b18..828d67a65e 100644 --- a/test/JDBC/upgrade/14_3/schedule +++ b/test/JDBC/upgrade/14_3/schedule @@ -57,7 +57,7 @@ BABEL-3116 BABEL-3118 BABEL-3121 BABEL-3147-before-14_5 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -292,7 +292,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_5/schedule b/test/JDBC/upgrade/14_5/schedule index 9fe4585c96..1d51939910 100644 --- a/test/JDBC/upgrade/14_5/schedule +++ b/test/JDBC/upgrade/14_5/schedule @@ -55,7 +55,7 @@ BABEL-3116 BABEL-3118 BABEL-3121 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -308,7 +308,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_6/schedule b/test/JDBC/upgrade/14_6/schedule index 7ad6936075..44a09152e1 100644 --- a/test/JDBC/upgrade/14_6/schedule +++ b/test/JDBC/upgrade/14_6/schedule @@ -61,7 +61,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -342,7 +342,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_7/schedule b/test/JDBC/upgrade/14_7/schedule index 4ceb592efb..aa132a0de6 100644 --- a/test/JDBC/upgrade/14_7/schedule +++ b/test/JDBC/upgrade/14_7/schedule @@ -63,7 +63,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -360,7 +360,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_8/schedule b/test/JDBC/upgrade/14_8/schedule index 527fc5e57a..9cf794cdd5 100644 --- a/test/JDBC/upgrade/14_8/schedule +++ b/test/JDBC/upgrade/14_8/schedule @@ -63,7 +63,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -358,7 +358,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_9/schedule b/test/JDBC/upgrade/14_9/schedule index 367c135afa..2ac1f3b69e 100644 --- a/test/JDBC/upgrade/14_9/schedule +++ b/test/JDBC/upgrade/14_9/schedule @@ -12,7 +12,7 @@ BABEL-3613 babelfish_cast_floor babel_try_parse TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar TestDatetime2 @@ -46,7 +46,7 @@ sys-suser_sid sys-trigger_events BABEL-2688 BABEL-328 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3221 BABEL-3204 diff --git a/test/JDBC/upgrade/15_1/schedule b/test/JDBC/upgrade/15_1/schedule index 745d4ace3f..24b5bcb9ad 100644 --- a/test/JDBC/upgrade/15_1/schedule +++ b/test/JDBC/upgrade/15_1/schedule @@ -61,7 +61,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -341,7 +341,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_2/schedule b/test/JDBC/upgrade/15_2/schedule index c18de8224d..d0794dd932 100644 --- a/test/JDBC/upgrade/15_2/schedule +++ b/test/JDBC/upgrade/15_2/schedule @@ -63,7 +63,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -366,7 +366,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_3/schedule b/test/JDBC/upgrade/15_3/schedule index 9844bb1691..195ddbb6f9 100644 --- a/test/JDBC/upgrade/15_3/schedule +++ b/test/JDBC/upgrade/15_3/schedule @@ -65,7 +65,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -381,7 +381,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_4/schedule b/test/JDBC/upgrade/15_4/schedule index 61b24ca550..815b22571f 100644 --- a/test/JDBC/upgrade/15_4/schedule +++ b/test/JDBC/upgrade/15_4/schedule @@ -65,7 +65,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -388,7 +388,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_5/schedule b/test/JDBC/upgrade/15_5/schedule index 9eca53fdc4..3fc5cefec3 100644 --- a/test/JDBC/upgrade/15_5/schedule +++ b/test/JDBC/upgrade/15_5/schedule @@ -65,7 +65,7 @@ BABEL-3118 BABEL-3121 BABEL-3144 BABEL-3147 -BABEL-3166 +BABEL-3166-before-14_11-or-15_6 BABEL-3192 BABEL-3204 BABEL-3213 @@ -397,7 +397,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary +TestBinary-before-14_11-or-15_6 TestBIT TestChar Test-Computed-Columns From a4b146048b99457fff62649cdf426eb5413980c4 Mon Sep 17 00:00:00 2001 From: Tanzeel Khan Date: Thu, 14 Dec 2023 10:34:21 +0000 Subject: [PATCH 2/5] update tests Signed-off-by: Tanzeel Khan --- ...Binary-before-14_11-or-15_6-vu-cleanup.out | 4 --- ...Binary-before-14_11-or-15_6-vu-prepare.out | 33 ------------------- ...tBinary-before-14_11-or-15_6-vu-verify.out | 28 ---------------- ...Binary-before-14_11-or-15_6-vu-cleanup.txt | 4 --- ...Binary-before-14_11-or-15_6-vu-prepare.txt | 17 ---------- ...tBinary-before-14_11-or-15_6-vu-verify.txt | 4 --- test/JDBC/jdbc_schedule | 3 -- test/JDBC/upgrade/13_4/schedule | 2 +- test/JDBC/upgrade/13_5/schedule | 2 +- test/JDBC/upgrade/13_6/schedule | 2 +- test/JDBC/upgrade/13_7/schedule | 2 +- test/JDBC/upgrade/13_8/schedule | 2 +- test/JDBC/upgrade/13_9/schedule | 2 +- test/JDBC/upgrade/14_10/schedule | 2 +- test/JDBC/upgrade/14_11/schedule | 2 +- test/JDBC/upgrade/14_3/schedule | 2 +- test/JDBC/upgrade/14_5/schedule | 2 +- test/JDBC/upgrade/14_6/schedule | 2 +- test/JDBC/upgrade/14_7/schedule | 2 +- test/JDBC/upgrade/14_8/schedule | 2 +- test/JDBC/upgrade/14_9/schedule | 2 +- test/JDBC/upgrade/15_1/schedule | 2 +- test/JDBC/upgrade/15_2/schedule | 2 +- test/JDBC/upgrade/15_3/schedule | 2 +- test/JDBC/upgrade/15_4/schedule | 2 +- test/JDBC/upgrade/15_5/schedule | 2 +- 26 files changed, 19 insertions(+), 112 deletions(-) delete mode 100644 test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out delete mode 100644 test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out delete mode 100644 test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out delete mode 100644 test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt delete mode 100644 test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt delete mode 100644 test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt diff --git a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out deleted file mode 100644 index e3c1b0f3f7..0000000000 --- a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-cleanup.out +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE testBINARY_dt1 -DROP TABLE testBINARY_dt2 -DROP TABLE testBINARY_dt3 -DROP TABLE testBINARY_dt4 diff --git a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out deleted file mode 100644 index 35de0cfd73..0000000000 --- a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-prepare.out +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE testBINARY_dt1(a BINARY(8), b VARBINARY(10)); -#inserting random values -INSERT INTO testBINARY_dt1(a, b) values (1234, 12345); -~~ROW COUNT: 1~~ - -INSERT INTO testBINARY_dt1(a, b) values (NULL, NULL); -~~ROW COUNT: 1~~ - -#INSERT INTO testBINARY_dt1(a, b) values (0x31323334, 0x3132333435); - -CREATE TABLE testBINARY_dt2(a VARBINARY(max)); -INSERT INTO testBINARY_dt2(a) values (NULL); -~~ROW COUNT: 1~~ - - -create table testBINARY_dt3 (a VARBINARY(max), b int, c int, d int, e int ,f int, g int, h int, i int); -insert into testBINARY_dt3 (a,b,c,d,e,f,g,h,i) values (NULL,1,2,3,4,5,6,7,8); -~~ROW COUNT: 1~~ - - -CREATE TABLE testBINARY_dt4(a BINARY(8), b VARBINARY(10)); -INSERT INTO testBINARY_dt4(a, b) values (1234, 12345); -~~ROW COUNT: 1~~ - -prepst#!# INSERT INTO testBINARY_dt4(a, b) values(?, ?) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 -~~ROW COUNT: 1~~ - -prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 -~~ROW COUNT: 1~~ - -prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 -~~ROW COUNT: 1~~ - diff --git a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out b/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out deleted file mode 100644 index 12ad105ab3..0000000000 --- a/test/JDBC/expected/TestBinary-before-14_11-or-15_6-vu-verify.out +++ /dev/null @@ -1,28 +0,0 @@ -SELECT * FROM testBINARY_dt1 -~~START~~ -binary#!#varbinary -00000000000004D2#!#00003039 -#!# -~~END~~ - -SELECT * FROM testBINARY_dt2 -~~START~~ -varbinary - -~~END~~ - -SELECT * FROM testBINARY_dt3 -~~START~~ -varbinary#!#int#!#int#!#int#!#int#!#int#!#int#!#int#!#int -#!#1#!#2#!#3#!#4#!#5#!#6#!#7#!#8 -~~END~~ - -SELECT * FROM testBINARY_dt4 -~~START~~ -binary#!#varbinary -00000000000004D2#!#00003039 -3132333400000000#!#3132333435 -3132333435363738#!#3132333435 -3132333400000000#!#313233343536373839 -~~END~~ - diff --git a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt deleted file mode 100644 index e3c1b0f3f7..0000000000 --- a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-cleanup.txt +++ /dev/null @@ -1,4 +0,0 @@ -DROP TABLE testBINARY_dt1 -DROP TABLE testBINARY_dt2 -DROP TABLE testBINARY_dt3 -DROP TABLE testBINARY_dt4 diff --git a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt deleted file mode 100644 index e020a18017..0000000000 --- a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-prepare.txt +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE testBINARY_dt1(a BINARY(8), b VARBINARY(10)); -#inserting random values -INSERT INTO testBINARY_dt1(a, b) values (1234, 12345); -INSERT INTO testBINARY_dt1(a, b) values (NULL, NULL); -#INSERT INTO testBINARY_dt1(a, b) values (0x31323334, 0x3132333435); - -CREATE TABLE testBINARY_dt2(a VARBINARY(max)); -INSERT INTO testBINARY_dt2(a) values (NULL); - -create table testBINARY_dt3 (a VARBINARY(max), b int, c int, d int, e int ,f int, g int, h int, i int); -insert into testBINARY_dt3 (a,b,c,d,e,f,g,h,i) values (NULL,1,2,3,4,5,6,7,8); - -CREATE TABLE testBINARY_dt4(a BINARY(8), b VARBINARY(10)); -INSERT INTO testBINARY_dt4(a, b) values (1234, 12345); -prepst#!# INSERT INTO testBINARY_dt4(a, b) values(@a, @b) #!#binary|-|a|-|1234#!#varbinary|-|b|-|12345 -prepst#!#exec#!#binary|-|a|-|123456789#!#varbinary|-|b|-|12345 -prepst#!#exec#!#binary|-|a|-|1234#!#varbinary|-|b|-|123456789 \ No newline at end of file diff --git a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt b/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt deleted file mode 100644 index 530fa79de6..0000000000 --- a/test/JDBC/input/datatypes/TestBinary-before-14_11-or-15_6-vu-verify.txt +++ /dev/null @@ -1,4 +0,0 @@ -SELECT * FROM testBINARY_dt1 -SELECT * FROM testBINARY_dt2 -SELECT * FROM testBINARY_dt3 -SELECT * FROM testBINARY_dt4 \ No newline at end of file diff --git a/test/JDBC/jdbc_schedule b/test/JDBC/jdbc_schedule index f9f28a83f7..ae0a082464 100644 --- a/test/JDBC/jdbc_schedule +++ b/test/JDBC/jdbc_schedule @@ -98,9 +98,6 @@ ignore#!#babel_function_string-before-15-5-or-14-10-vu-prepare ignore#!#babel_function_string-before-15-5-or-14-10-vu-verify ignore#!#BABEL-3166-before-14_11-or-15_6-vu-prepare ignore#!#BABEL-3166-before-14_11-or-15_6-vu-verify -ignore#!#TestBinary-before-14_11-or-15_6-vu-prepare -ignore#!#TestBinary-before-14_11-or-15_6-vu-verify -ignore#!#TestBinary-before-14_11-or-15_6-vu-cleanup # These tests are meant for upgrade scenario where source version is 13_X ignore#!#sys_database_principals_dep_for_13_x-vu-cleanup diff --git a/test/JDBC/upgrade/13_4/schedule b/test/JDBC/upgrade/13_4/schedule index 40815d6ece..546230ab5d 100644 --- a/test/JDBC/upgrade/13_4/schedule +++ b/test/JDBC/upgrade/13_4/schedule @@ -178,7 +178,7 @@ sys-views-dep tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar TestDate diff --git a/test/JDBC/upgrade/13_5/schedule b/test/JDBC/upgrade/13_5/schedule index 39bae05db1..178be03385 100644 --- a/test/JDBC/upgrade/13_5/schedule +++ b/test/JDBC/upgrade/13_5/schedule @@ -228,7 +228,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_6/schedule b/test/JDBC/upgrade/13_6/schedule index 110753dd4c..c71fe72a52 100644 --- a/test/JDBC/upgrade/13_6/schedule +++ b/test/JDBC/upgrade/13_6/schedule @@ -281,7 +281,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_7/schedule b/test/JDBC/upgrade/13_7/schedule index 2f3a830a3c..be21ea4fee 100644 --- a/test/JDBC/upgrade/13_7/schedule +++ b/test/JDBC/upgrade/13_7/schedule @@ -275,7 +275,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_8/schedule b/test/JDBC/upgrade/13_8/schedule index 2f3a830a3c..be21ea4fee 100644 --- a/test/JDBC/upgrade/13_8/schedule +++ b/test/JDBC/upgrade/13_8/schedule @@ -275,7 +275,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/13_9/schedule b/test/JDBC/upgrade/13_9/schedule index 21234c1008..2cbfcd5831 100644 --- a/test/JDBC/upgrade/13_9/schedule +++ b/test/JDBC/upgrade/13_9/schedule @@ -277,7 +277,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_10/schedule b/test/JDBC/upgrade/14_10/schedule index cae56a168e..7037323665 100644 --- a/test/JDBC/upgrade/14_10/schedule +++ b/test/JDBC/upgrade/14_10/schedule @@ -12,7 +12,7 @@ BABEL-3613 babelfish_cast_floor babel_try_parse TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar TestDatetime2 diff --git a/test/JDBC/upgrade/14_11/schedule b/test/JDBC/upgrade/14_11/schedule index cae56a168e..7037323665 100644 --- a/test/JDBC/upgrade/14_11/schedule +++ b/test/JDBC/upgrade/14_11/schedule @@ -12,7 +12,7 @@ BABEL-3613 babelfish_cast_floor babel_try_parse TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar TestDatetime2 diff --git a/test/JDBC/upgrade/14_3/schedule b/test/JDBC/upgrade/14_3/schedule index 828d67a65e..dcfe150785 100644 --- a/test/JDBC/upgrade/14_3/schedule +++ b/test/JDBC/upgrade/14_3/schedule @@ -292,7 +292,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_5/schedule b/test/JDBC/upgrade/14_5/schedule index 1d51939910..662d862271 100644 --- a/test/JDBC/upgrade/14_5/schedule +++ b/test/JDBC/upgrade/14_5/schedule @@ -308,7 +308,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_6/schedule b/test/JDBC/upgrade/14_6/schedule index 44a09152e1..24f21915f2 100644 --- a/test/JDBC/upgrade/14_6/schedule +++ b/test/JDBC/upgrade/14_6/schedule @@ -342,7 +342,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_7/schedule b/test/JDBC/upgrade/14_7/schedule index aa132a0de6..e5070a72c6 100644 --- a/test/JDBC/upgrade/14_7/schedule +++ b/test/JDBC/upgrade/14_7/schedule @@ -360,7 +360,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_8/schedule b/test/JDBC/upgrade/14_8/schedule index 9cf794cdd5..8f5549dcdc 100644 --- a/test/JDBC/upgrade/14_8/schedule +++ b/test/JDBC/upgrade/14_8/schedule @@ -358,7 +358,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/14_9/schedule b/test/JDBC/upgrade/14_9/schedule index 2ac1f3b69e..7826261c69 100644 --- a/test/JDBC/upgrade/14_9/schedule +++ b/test/JDBC/upgrade/14_9/schedule @@ -12,7 +12,7 @@ BABEL-3613 babelfish_cast_floor babel_try_parse TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar TestDatetime2 diff --git a/test/JDBC/upgrade/15_1/schedule b/test/JDBC/upgrade/15_1/schedule index 24b5bcb9ad..21f94a4e27 100644 --- a/test/JDBC/upgrade/15_1/schedule +++ b/test/JDBC/upgrade/15_1/schedule @@ -341,7 +341,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_2/schedule b/test/JDBC/upgrade/15_2/schedule index d0794dd932..66fc4240da 100644 --- a/test/JDBC/upgrade/15_2/schedule +++ b/test/JDBC/upgrade/15_2/schedule @@ -366,7 +366,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_3/schedule b/test/JDBC/upgrade/15_3/schedule index 195ddbb6f9..c4fc3cc556 100644 --- a/test/JDBC/upgrade/15_3/schedule +++ b/test/JDBC/upgrade/15_3/schedule @@ -381,7 +381,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_4/schedule b/test/JDBC/upgrade/15_4/schedule index 815b22571f..2ef40d8fa5 100644 --- a/test/JDBC/upgrade/15_4/schedule +++ b/test/JDBC/upgrade/15_4/schedule @@ -388,7 +388,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns diff --git a/test/JDBC/upgrade/15_5/schedule b/test/JDBC/upgrade/15_5/schedule index 3fc5cefec3..d94f9961bd 100644 --- a/test/JDBC/upgrade/15_5/schedule +++ b/test/JDBC/upgrade/15_5/schedule @@ -397,7 +397,7 @@ table-variable tdscollation temp-tables TestBigInt -TestBinary-before-14_11-or-15_6 +TestBinary TestBIT TestChar Test-Computed-Columns From f82838412d3c623fe7ad08a0a6a4e39a7788961d Mon Sep 17 00:00:00 2001 From: Tanzeel Khan Date: Wed, 20 Dec 2023 16:38:44 +0000 Subject: [PATCH 3/5] update schedule fie for 14.11 Signed-off-by: Tanzeel Khan --- test/JDBC/upgrade/14_11/schedule | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/JDBC/upgrade/14_11/schedule b/test/JDBC/upgrade/14_11/schedule index 7037323665..0b1bb7ddba 100644 --- a/test/JDBC/upgrade/14_11/schedule +++ b/test/JDBC/upgrade/14_11/schedule @@ -46,7 +46,7 @@ sys-suser_sid sys-trigger_events BABEL-2688 BABEL-328 -BABEL-3166-before-14_11-or-15_6 +BABEL-3166 BABEL-3192 BABEL-3221 BABEL-3204 From af41012ba35c0b7c998c7d75713e43254434bf0e Mon Sep 17 00:00:00 2001 From: Tanzeel Khan Date: Wed, 20 Dec 2023 16:54:03 +0000 Subject: [PATCH 4/5] add upgrade path babelfish common from 2.6.0 to 3.0.0 Signed-off-by: Tanzeel Khan --- .../babelfishpg_common--2.6.0--3.0.0.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 contrib/babelfishpg_common/sql/upgrades/babelfishpg_common--2.6.0--3.0.0.sql diff --git a/contrib/babelfishpg_common/sql/upgrades/babelfishpg_common--2.6.0--3.0.0.sql b/contrib/babelfishpg_common/sql/upgrades/babelfishpg_common--2.6.0--3.0.0.sql new file mode 100644 index 0000000000..cf9363ee76 --- /dev/null +++ b/contrib/babelfishpg_common/sql/upgrades/babelfishpg_common--2.6.0--3.0.0.sql @@ -0,0 +1,16 @@ +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ""babelfishpg_common"" UPDATE TO '3.0.0'" to load this file. \quit + +SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); + +/* This helper function would only be useful and strictly be used during 1.x->2.3 and 2.3->3.0 upgrade. */ +CREATE OR REPLACE FUNCTION sys.babelfish_update_server_collation_name() RETURNS VOID +LANGUAGE C +AS 'babelfishpg_common', 'babelfish_update_server_collation_name'; + +SELECT sys.babelfish_update_server_collation_name(); + +DROP FUNCTION sys.babelfish_update_server_collation_name(); + +-- Reset search_path to not affect any subsequent scripts +SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false); From 9dfae97a03fe02d9dbc1126a9ac955a79a135020 Mon Sep 17 00:00:00 2001 From: Tanzeel Khan Date: Wed, 20 Dec 2023 17:02:51 +0000 Subject: [PATCH 5/5] update expected drop file Signed-off-by: Tanzeel Khan --- test/python/expected/sql_validation_framework/expected_drop.out | 1 + 1 file changed, 1 insertion(+) diff --git a/test/python/expected/sql_validation_framework/expected_drop.out b/test/python/expected/sql_validation_framework/expected_drop.out index b6fdedd393..4e13ec5d45 100644 --- a/test/python/expected/sql_validation_framework/expected_drop.out +++ b/test/python/expected/sql_validation_framework/expected_drop.out @@ -9,6 +9,7 @@ Unexpected drop found for function sys.babelfish_update_server_collation_name in Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_common--2.3.0--3.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_common--2.4.0--3.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_common--2.5.0--3.0.0.sql +Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_common--2.6.0--3.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--2.0.0--2.1.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--2.3.0--3.0.0.sql Unexpected drop found for function sys.babelfish_update_server_collation_name in file babelfishpg_tsql--2.4.0--3.0.0.sql