diff --git a/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c b/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c index 08b6163ff2..a1ab6b92d3 100644 --- a/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c +++ b/contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c @@ -543,6 +543,19 @@ resolve_numeric_typmod_from_exp(Plan *plan, Node *expr) return -1; switch (nodeTag(expr)) { + case T_Param: + { + Param *param = (Param *) expr; + if (!is_numeric_datatype(param->paramtype)) + { + /* typmod is undefined */ + return -1; + } + else + { + return param->paramtypmod; + } + } case T_Const: { Const *con = (Const *) expr; diff --git a/contrib/babelfishpg_tsql/sql/sys_functions.sql b/contrib/babelfishpg_tsql/sql/sys_functions.sql index 20a7f613a6..06677db52c 100644 --- a/contrib/babelfishpg_tsql/sql/sys_functions.sql +++ b/contrib/babelfishpg_tsql/sql/sys_functions.sql @@ -5422,3 +5422,7 @@ CREATE OR REPLACE AGGREGATE sys.string_agg(sys.NVARCHAR, sys.VARCHAR) ( PARALLEL = SAFE ); +/* Helper function to update local variables dynamically during execution */ +CREATE OR REPLACE FUNCTION sys.pltsql_assign_var(dno INT, val ANYELEMENT) +RETURNS ANYELEMENT +AS 'babelfishpg_tsql', 'pltsql_assign_var' LANGUAGE C PARALLEL UNSAFE; diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql index 9d5a796674..42762c37b7 100644 --- a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--4.5.0.sql @@ -54,6 +54,11 @@ BEGIN END; $$; +/* Helper function to update local variables dynamically during execution */ +CREATE OR REPLACE FUNCTION sys.pltsql_assign_var(dno INT, val ANYELEMENT) +RETURNS ANYELEMENT +AS 'babelfishpg_tsql', 'pltsql_assign_var' LANGUAGE C PARALLEL UNSAFE; + -- After upgrade, always run analyze for all babelfish catalogs. CALL sys.analyze_babelfish_catalogs(); diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--5.0.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--5.0.0.sql index 181f533310..8a4bc849e3 100644 --- a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--5.0.0.sql +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--4.4.0--5.0.0.sql @@ -932,6 +932,11 @@ END; $$; GRANT EXECUTE on PROCEDURE sys.sp_rename(IN sys.nvarchar(776), IN sys.SYSNAME, IN sys.varchar(13)) TO PUBLIC; +/* Helper function to update local variables dynamically during execution */ +CREATE OR REPLACE FUNCTION sys.pltsql_assign_var(dno INT, val ANYELEMENT) +RETURNS ANYELEMENT +AS 'babelfishpg_tsql', 'pltsql_assign_var' LANGUAGE C PARALLEL UNSAFE; + -- Drops the temporary procedure used by the upgrade script. -- Please have this be one of the last statements executed in this upgrade script. DROP PROCEDURE sys.babelfish_drop_deprecated_object(varchar, varchar, varchar); diff --git a/contrib/babelfishpg_tsql/src/collation.c b/contrib/babelfishpg_tsql/src/collation.c index 66bd381f7e..cd90bfd506 100644 --- a/contrib/babelfishpg_tsql/src/collation.c +++ b/contrib/babelfishpg_tsql/src/collation.c @@ -1136,6 +1136,16 @@ pltsql_planner_node_transformer(PlannerInfo *root, Node *expr, int kind) { + /* + * check if this is called to reset saved expression kind. Quickly return if so. + */ + if (kind == -1) + { + Assert(expr == NULL); + saved_expr_kind = -1; + return NULL; + } + /* * Fall out quickly if expression is empty. */ @@ -1144,6 +1154,7 @@ pltsql_planner_node_transformer(PlannerInfo *root, if (EXPRKIND_TARGET == kind) { + saved_expr_kind = EXPRKIND_TARGET; /* * If expr is NOT a Boolean expression then recurse through its * expresion tree diff --git a/contrib/babelfishpg_tsql/src/pl_exec.c b/contrib/babelfishpg_tsql/src/pl_exec.c index f0dae9ebd7..ac69005eb2 100644 --- a/contrib/babelfishpg_tsql/src/pl_exec.c +++ b/contrib/babelfishpg_tsql/src/pl_exec.c @@ -62,7 +62,6 @@ #include "guc.h" #include "multidb.h" #include "session.h" -#include "guc.h" #include "catalog.h" uint64 rowcount_var = 0; @@ -70,6 +69,7 @@ List *columns_updated_list = NIL; static char *original_query_string = NULL; int fetch_status_var = 0; +int saved_expr_kind = -1; typedef struct { @@ -4368,6 +4368,7 @@ pltsql_estate_setup(PLtsql_execstate *estate, pltsql_init_exec_error_data(&(es_cs_entry->error_data)); es_cs_entry->next = exec_state_call_stack; exec_state_call_stack = es_cs_entry; + saved_expr_kind = -1; } /* ---------- @@ -7858,12 +7859,22 @@ pltsql_param_fetch(ParamListInfo params, } } + if (saved_expr_kind == EXPRKIND_TARGET) + { + /* Let extension to set value of param dynamically during execution when variables appears in TargetList */ + prm->pflags = 0; + } + else + { + /* For other cases, for example, Quals, we can always mark params as "const" for executor's purposes */ + prm->pflags = PARAM_FLAG_CONST; + } + /* Return "no such parameter" if not ok */ if (!ok) { prm->value = (Datum) 0; prm->isnull = true; - prm->pflags = 0; prm->ptype = InvalidOid; return prm; } @@ -7872,8 +7883,6 @@ pltsql_param_fetch(ParamListInfo params, exec_eval_datum(estate, datum, &prm->ptype, &prmtypmod, &prm->value, &prm->isnull); - /* We can always mark params as "const" for executor's purposes */ - prm->pflags = PARAM_FLAG_CONST; /* * If it's a read/write expanded datum, convert reference to read-only, @@ -10423,3 +10432,38 @@ pltsql_exec_function_cleanup(PLtsql_execstate *estate, PLtsql_function *func, Er } PG_END_TRY(); } + +PG_FUNCTION_INFO_V1(pltsql_assign_var); + +/* + * pltsql_assign_var - Helper function to update local variables dynamically during execution. + * Any statement which updates local variables as part of TargetList will be re-written using + * this function. for example, + * @var = expr will be re-written to @var=sys.pltsql_assign_var(dno, cast((expr) as type)). + */ +Datum +pltsql_assign_var(PG_FUNCTION_ARGS) +{ + int dno = PG_GETARG_INT32(0); + Datum data = PG_GETARG_DATUM(1); + Oid valtype = get_fn_expr_argtype(fcinfo->flinfo, 1); + bool isNull = PG_ARGISNULL(1); + int32 valtypmod = -1; + PLtsql_datum *target; + MemoryContext oldcontext; + + PLtsql_execstate *estate = get_current_tsql_estate(); + Assert(estate != NULL); + oldcontext = MemoryContextSwitchTo(estate->datum_context); + target = estate->datums[dno]; + + /* we will reuse exec_assign_value function here provided in pl_exec.c */ + exec_assign_value(estate, target, data, isNull, valtype, valtypmod); + + MemoryContextSwitchTo(oldcontext); + + if (isNull) + PG_RETURN_NULL(); + + PG_RETURN_DATUM(data); +} \ No newline at end of file diff --git a/contrib/babelfishpg_tsql/src/pltsql.h b/contrib/babelfishpg_tsql/src/pltsql.h index 2694990141..e6497d2d65 100644 --- a/contrib/babelfishpg_tsql/src/pltsql.h +++ b/contrib/babelfishpg_tsql/src/pltsql.h @@ -2264,6 +2264,13 @@ extern bool pltsql_trace_exec_codes; extern bool pltsql_trace_exec_counts; extern bool pltsql_trace_exec_time; +/* + * saved_expr_kind - special context to store which kind of expression if being processed. + * This is useful specially when handling declared variables because variables are dynamic only when it appears + * in the TargetList. Should be folded as const otherwise. + */ +extern int saved_expr_kind; + /* * Functions in cursor.c */ @@ -2329,4 +2336,9 @@ extern void exec_alter_role_cmd(char *query_str, RoleSpec *role); extern bool validate_special_function(char *proc_nsname, char *proc_name, List* fargs, int nargs, Oid *input_typeids, bool num_args_match); extern void init_special_function_list(void); +/* + * Function in pltsql_ruleutils.c + */ +extern char *tsql_format_type_extended(Oid type_oid, int32 typemod, bits16 flags); + #endif /* PLTSQL_H */ diff --git a/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c b/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c index 462aebe5c7..42a21a672d 100644 --- a/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c +++ b/contrib/babelfishpg_tsql/src/pltsql_ruleutils.c @@ -345,7 +345,6 @@ static char *tsql_get_constraintdef_worker(Oid constraintId, bool fullCommand, static text *tsql_get_expr_worker(text *expr, Oid relid, const char *relname, int prettyFlags); static char *tsql_printTypmod(const char *typname, int32 typmod, Oid typmodout); -static char *tsql_format_type_extended(Oid type_oid, int32 typemod, bits16 flags); int tsql_print_function_arguments(StringInfo buf, HeapTuple proctup, bool print_table_args, bool print_defaults, int **typmod_arr_arg, bool *has_tvp); char *tsql_quote_qualified_identifier(const char *qualifier, const char *ident); @@ -2793,7 +2792,7 @@ find_recursive_union(deparse_namespace *dpns, WorkTableScan *wtscan) * * Returns a palloc'd string. */ -static char * +char * tsql_format_type_extended(Oid type_oid, int32 typemod, bits16 flags) { HeapTuple tuple; diff --git a/contrib/babelfishpg_tsql/src/tsqlIface.cpp b/contrib/babelfishpg_tsql/src/tsqlIface.cpp index 958c2a6f1c..1f68f9eaa3 100644 --- a/contrib/babelfishpg_tsql/src/tsqlIface.cpp +++ b/contrib/babelfishpg_tsql/src/tsqlIface.cpp @@ -43,6 +43,7 @@ extern "C" { #include "catalog/namespace.h" #include "catalog/pg_proc.h" #include "parser/scansup.h" +#include "utils/builtins.h" #include "guc.h" @@ -177,7 +178,7 @@ TSqlParser::Query_specificationContext *get_query_specification(TSqlParser::Sele static bool is_top_level_query_specification(TSqlParser::Query_specificationContext *ctx); static bool is_quotation_needed_for_column_alias(TSqlParser::Column_aliasContext *ctx); static bool is_compiling_create_function(); -static void process_query_specification(TSqlParser::Query_specificationContext *qctx, PLtsql_expr_query_mutator *mutator); +static void process_query_specification(TSqlParser::Query_specificationContext *qctx, PLtsql_expr_query_mutator *mutator, bool process_local_id_assignment); static void process_select_statement(TSqlParser::Select_statementContext *selectCtx, PLtsql_expr_query_mutator *mutator); static void process_select_statement_standalone(TSqlParser::Select_statement_standaloneContext *standaloneCtx, PLtsql_expr_query_mutator *mutator, tsqlBuilder &builder); template static std::string rewrite_object_name_with_omitted_db_and_schema_name(T ctx, GetCtxFunc getDatabase, GetCtxFunc getSchema, GetCtxFunc getObject); @@ -1353,7 +1354,7 @@ class tsqlSelectStatementMutator : public TSqlParserBaseListener void exitQuery_specification(TSqlParser::Query_specificationContext *ctx) override { if (mutator) - process_query_specification(ctx, mutator); + process_query_specification(ctx, mutator, false); } void exitTable_source_item(TSqlParser::Table_source_itemContext *ctx) override @@ -2797,7 +2798,7 @@ class tsqlBuilder : public tsqlCommonMutator } has_identity_function = false; if (statementMutator) - process_query_specification(ctx, statementMutator.get()); + process_query_specification(ctx, statementMutator.get(), true); } void exitDrop_relational_or_xml_or_spatial_index(TSqlParser::Drop_relational_or_xml_or_spatial_indexContext *ctx) override @@ -3381,11 +3382,89 @@ class MyParserErrorListener: public antlr4::BaseErrorListener }; /* - * Necessary checks and mutations for query_specification + * handle_local_ids_for_expression - removes all the local_ids from local_id_positions of given expression. + * This is useful in case of local_id assignement as part of select elements for which we don't want to quote local_id. + */ +static void +handle_local_ids_for_expression(TSqlParser::ExpressionContext *ectx) +{ + std::vector keysToRemove; + for(auto &it : local_id_positions) + { + if (it.first >= ectx->start->getStartIndex() && it.first <= ectx->stop->getStopIndex()) + { + keysToRemove.push_back(it.first); + } + } + for (const auto &key : keysToRemove) local_id_positions.erase(key); + keysToRemove.clear(); +} + +/* + * add_rewritten_query_fragment_for_select_expression - should be called from the context of + * variable assignment expression. It will add all the already re-written query fragments to + * expression(). + */ +static void +add_rewritten_query_fragment_for_select_expression(PLtsql_expr_query_mutator *mutator) +{ + std::vector keysToRemove; + Assert(mutator); + TSqlParser::ExpressionContext *ectx = (TSqlParser::ExpressionContext *) mutator->ctx; + for (auto &entry : rewritten_query_fragment) + { + if (entry.first >= ectx->start->getStartIndex() && entry.first <= ectx->stop->getStopIndex()) + { + mutator->add(entry.first, entry.second.first, entry.second.second); + keysToRemove.push_back(entry.first); + } + } + for (const auto &key : keysToRemove) rewritten_query_fragment.erase(key); + keysToRemove.clear(); +} + +/* + * rewrite_assignment_expression - This will re-write assignment expression by adding already re-written fragments to it. + * It also add appropriate cast around expression needed by sys.pltsql_assign_var to assign value to var. + */ +static char * +rewrite_assignment_expression(PLtsql_var *var, TSqlParser::ExpressionContext *ectx) +{ + char *new_expr = NULL; + char *type_str = tsql_format_type_extended(var->datatype->typoid, var->datatype->atttypmod, FORMAT_TYPE_TYPEMOD_GIVEN); + PLtsql_expr *elem_expr = makeTsqlExpr(ectx, false); + PLtsql_expr_query_mutator expr_mutator(elem_expr, ectx); + add_rewritten_query_fragment_for_select_expression(&expr_mutator); + expr_mutator.run(); + + Assert(type_str); + /* + * Extra handling for type - If var->datatype->atttypmod = -1 and if "max" typmod is allowed for type (e.g., varchar, varbinary etc) + * then append explicit (max). Check implementation of parse_datatype and tsql_format_type_extended for more details. + */ + if (var->datatype->atttypmod == -1 && is_tsql_datatype_with_max_scale_expr_allowed(var->datatype->typoid)) + { + char *tmp = psprintf("%s(max)", type_str); + pfree(type_str); + type_str = tmp; + } + + new_expr = psprintf("cast((%s) as %s)", + elem_expr->query, + type_str); + + return new_expr; +} + +/* + * Necessary checks and mutations for query_specification. + * @process_local_id_assignment indicates whether local_id assignement should be re-written or not. Passed false when we are handling + * statement like create or alter function. */ static void process_query_specification( TSqlParser::Query_specificationContext *qctx, - PLtsql_expr_query_mutator *mutator) + PLtsql_expr_query_mutator *mutator, + bool process_local_id_assignment) { Assert(qctx->select_list()); std::vector select_elems = qctx->select_list()->select_list_elem(); @@ -3475,6 +3554,76 @@ static void process_query_specification( mutator->add(column_alias_as->start->getStartIndex(), "", " AS "); } } + else if(process_local_id_assignment && elem->LOCAL_ID() && elem->EQUAL()) + { + const char *var_str = downcase_truncate_identifier(::getFullText(elem->LOCAL_ID()).c_str(), ::getFullText(elem->LOCAL_ID()).length(), true); + PLtsql_nsitem *nse = pltsql_ns_lookup(pltsql_ns_top(), false, var_str, nullptr, nullptr, nullptr); + char *repl_text = NULL; + + Assert(elem->expression()); + if (!nse) + throw PGErrorWrapperException(ERROR, ERRCODE_SYNTAX_ERROR, format_errmsg("\"%s\" is not a known variable", ::getFullText(elem->LOCAL_ID()).c_str()), getLineAndPos(elem)); + + /* Rewrite @var = expr to @var=sys.pltsql_assign_var(dno, cast((expr) as type)) */ + repl_text = psprintf("sys.pltsql_assign_var(%d, %s)", + nse->itemno, + rewrite_assignment_expression((PLtsql_var *) pltsql_Datums[nse->itemno], + elem->expression())); + + handle_local_ids_for_expression(elem->expression()); + mutator->add(elem->expression()->start->getStartIndex(), ::getFullText(elem->expression()), std::string(repl_text)); + } + else if(process_local_id_assignment && elem->LOCAL_ID() && elem->assignment_operator()) + { + const char *var_str = downcase_truncate_identifier(::getFullText(elem->LOCAL_ID()).c_str(), ::getFullText(elem->LOCAL_ID()).length(), true); + PLtsql_nsitem *nse = pltsql_ns_lookup(pltsql_ns_top(), false, var_str, nullptr, nullptr, nullptr); + char *repl_text = NULL; + tree::TerminalNode *anode = nullptr; + + if (elem->assignment_operator()) + { + if (elem->assignment_operator()->PLUS_ASSIGN()) + anode = elem->assignment_operator()->PLUS_ASSIGN(); + else if (elem->assignment_operator()->MINUS_ASSIGN()) + anode = elem->assignment_operator()->MINUS_ASSIGN(); + else if (elem->assignment_operator()->MULT_ASSIGN()) + anode = elem->assignment_operator()->MULT_ASSIGN(); + else if (elem->assignment_operator()->DIV_ASSIGN()) + anode = elem->assignment_operator()->DIV_ASSIGN(); + else if (elem->assignment_operator()->MOD_ASSIGN()) + anode = elem->assignment_operator()->MOD_ASSIGN(); + else if (elem->assignment_operator()->AND_ASSIGN()) + anode = elem->assignment_operator()->AND_ASSIGN(); + else if (elem->assignment_operator()->XOR_ASSIGN()) + anode = elem->assignment_operator()->XOR_ASSIGN(); + else if (elem->assignment_operator()->OR_ASSIGN()) + anode = elem->assignment_operator()->OR_ASSIGN(); + else + Assert(0); + } + + Assert(elem->expression()); + if (!nse) + throw PGErrorWrapperException(ERROR, ERRCODE_SYNTAX_ERROR, + format_errmsg("\"%s\" is not a known variable", + ::getFullText(elem->LOCAL_ID()).c_str()), getLineAndPos(elem)); + + /* + * Rewrite @var += expr to @var += sys.pltsql_assign_var(dno, "@var" + cast((expr) as type)). + * Note that we only update expr with sys.pltsql_assign_var(dno, "@var" + (expr) here and + * additional handling of assignment opetator will be done in process_execsql_destination_select + * when we create target row. + */ + repl_text = psprintf("sys.pltsql_assign_var(%d, %s %s %s)", + nse->itemno, + delimitIfAtAtUserVarName(::getFullText(elem->LOCAL_ID())).c_str(), + rewrite_assign_operator(anode), + rewrite_assignment_expression((PLtsql_var *) pltsql_Datums[nse->itemno], + elem->expression())); + + handle_local_ids_for_expression(elem->expression()); + mutator->add(elem->expression()->start->getStartIndex(), ::getFullText(elem->expression()), std::string(repl_text)); + } } } @@ -5480,7 +5629,6 @@ makeSetStatement(TSqlParser::Set_statementContext *ctx, tsqlBuilder &builder) char *target = pstrdup(targetText.c_str()); pltsql_parse_word(target, target, &wdatum, &word); - PLtsql_stmt_assign *result = (PLtsql_stmt_assign *) makeInitializer(dno, getLineNo(ctx), expr); int posStart = expr->getStart()->getStartIndex(); @@ -6896,8 +7044,12 @@ void process_execsql_destination_select(TSqlParser::Select_statement_standaloneC if (elem->EQUAL()) { - // in PG main parser, '@a=1' will be treated as a boolean expression to compare @a and 1. This is different T-SQL expected. - // We'll remove '@a=' from the query string so that main parser will return the expected result. + /* + * In PG main parser, @a=expr will be treated as a boolean expression to compare @a and expr. This is different T-SQL expected. + * We have re-written it as @a = sys.pltsql_assign_var(dno, expr) (check process_query_specification) so that appropriate result + * of expr is assigned to destination var dynamically and now we just need to remove '@a=' from the query string so that main parser + * will return the expected result. + */ removeTokenStringFromQuery(stmt->sqlstmt, elem->LOCAL_ID(), ctx); removeTokenStringFromQuery(stmt->sqlstmt, elem->EQUAL(), ctx); } @@ -6905,28 +7057,13 @@ void process_execsql_destination_select(TSqlParser::Select_statement_standaloneC { Assert(elem->assignment_operator()); - /* We'll rewrite the query similar with EQUAL() but we'll just remove '=' character from token */ - tree::TerminalNode *anode = nullptr; - if (elem->assignment_operator()->PLUS_ASSIGN()) - anode = elem->assignment_operator()->PLUS_ASSIGN(); - else if (elem->assignment_operator()->MINUS_ASSIGN()) - anode = elem->assignment_operator()->MINUS_ASSIGN(); - else if (elem->assignment_operator()->MULT_ASSIGN()) - anode = elem->assignment_operator()->MULT_ASSIGN(); - else if (elem->assignment_operator()->DIV_ASSIGN()) - anode = elem->assignment_operator()->DIV_ASSIGN(); - else if (elem->assignment_operator()->MOD_ASSIGN()) - anode = elem->assignment_operator()->MOD_ASSIGN(); - else if (elem->assignment_operator()->AND_ASSIGN()) - anode = elem->assignment_operator()->AND_ASSIGN(); - else if (elem->assignment_operator()->XOR_ASSIGN()) - anode = elem->assignment_operator()->XOR_ASSIGN(); - else if (elem->assignment_operator()->OR_ASSIGN()) - anode = elem->assignment_operator()->OR_ASSIGN(); - else - Assert(0); - - replaceTokenStringFromQuery(stmt->sqlstmt, anode, rewrite_assign_operator(anode), ctx); + /* + * select with assignment_operator must be re-written already, check process_query_specification. + * For example, @var += expr is already re-written to @var += sys.pltsql_assign_var(dno, "@var" + (expr)) + * Now, We'll rewrite the query similar with EQUAL() but we need to remove '@var +=' from query string. + */ + removeTokenStringFromQuery(stmt->sqlstmt, elem->LOCAL_ID(), ctx); + removeCtxStringFromQuery(stmt->sqlstmt, elem->assignment_operator(), ctx); } } else @@ -6985,6 +7122,10 @@ void process_execsql_destination_update(TSqlParser::Update_statementContext *uct auto elem = elems[i]; if (elem->LOCAL_ID()) { + const char *nameStr = downcase_truncate_identifier(::getFullText(elem->LOCAL_ID()).c_str(), ::getFullText(elem->LOCAL_ID()).length(), true); + PLtsql_nsitem *nse = pltsql_ns_lookup(pltsql_ns_top(), false, nameStr, nullptr, nullptr, nullptr); + PLtsql_var *var = (PLtsql_var *) pltsql_Datums[nse->itemno]; + add_assignment_target_field(target, elem->LOCAL_ID(), returning_col_cnt); if (returning_col_cnt > 0) @@ -6993,16 +7134,22 @@ void process_execsql_destination_update(TSqlParser::Update_statementContext *uct if (elem->full_column_name()) { - /* "SET @a=col=expr" => "SET col=expr ... RETURNING col" */ - appendStringInfo(&ds, "%s", ::getFullText(elem->full_column_name()).c_str()); + /* "SET @a=col=expr" => "SET col=expr ... RETURNING sys.pltsql_assign_var(dno, cast(expr as type))" */ + appendStringInfo(&ds, "sys.pltsql_assign_var(%d, cast(%s as %s))", + nse->itemno, + ::getFullText(elem->full_column_name()).c_str(), + tsql_format_type_extended(var->datatype->typoid, var->datatype->atttypmod, FORMAT_TYPE_TYPEMOD_GIVEN)); removeTokenStringFromQuery(stmt->sqlstmt, elem->LOCAL_ID(), uctx); removeTokenStringFromQuery(stmt->sqlstmt, elem->EQUAL(0), uctx); } else { - /* "SET @a=expr, col=expr2" => "SET col=expr2 ... RETURNING expr" */ - appendStringInfo(&ds, "%s", ::getFullText(elem->expression()).c_str()); + /* "SET @a=expr, col=expr2" => "SET col=expr2 ... RETURNING sys.pltsql_assign_var(dno, cast(expr as type))" */ + appendStringInfo(&ds, "sys.pltsql_assign_var(%d, cast(%s as %s))", + nse->itemno, + ::getFullText(elem->expression()).c_str(), + tsql_format_type_extended(var->datatype->typoid, var->datatype->atttypmod, FORMAT_TYPE_TYPEMOD_GIVEN)); removeTokenStringFromQuery(stmt->sqlstmt, elem->LOCAL_ID(), uctx); removeTokenStringFromQuery(stmt->sqlstmt, elem->EQUAL(0), uctx); diff --git a/test/JDBC/expected/Test-spatial-functions-vu-verify.out b/test/JDBC/expected/Test-spatial-functions-vu-verify.out index d782fabca1..1872298f3a 100644 --- a/test/JDBC/expected/Test-spatial-functions-vu-verify.out +++ b/test/JDBC/expected/Test-spatial-functions-vu-verify.out @@ -404,7 +404,7 @@ GO ~~START~~ numeric#!#int #!#1 -0#!#2 +0E-8#!#2 ~~END~~ @@ -810,7 +810,7 @@ bit ~~START~~ numeric#!#int #!#1 -0#!#2 +0E-8#!#2 ~~END~~ @@ -1027,6 +1027,8 @@ SET @point2 = 'Test_String'; SELECT @point1.STEquals(@point2); SELECT @point1.STContains(@point2); go +~~START~~ +bit ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: parse error - invalid geometry)~~ @@ -1038,6 +1040,8 @@ SET @point2 = 'Test_String'; SELECT @point1.STEquals(@point2); SELECT @point1.STContains(@point2); go +~~START~~ +bit ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: parse error - invalid geometry)~~ diff --git a/test/JDBC/expected/TestSpatialPoint-vu-verify.out b/test/JDBC/expected/TestSpatialPoint-vu-verify.out index d4d953a032..4f23dbaed3 100644 --- a/test/JDBC/expected/TestSpatialPoint-vu-verify.out +++ b/test/JDBC/expected/TestSpatialPoint-vu-verify.out @@ -223,6 +223,8 @@ SET @point1 = geometry::Point(22.34900, -47.65100, 4326);; SET @point2 = 'Test_String'; SELECT @point1.STDistance(@point2); Go +~~START~~ +float ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: parse error - invalid geometry)~~ @@ -2314,6 +2316,8 @@ SET @point1 = geography::Point(22.34900, -47.65100, 4326); SET @point2 = 'Test_String'; SELECT @point2.STDistance(@point1); Go +~~START~~ +float ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: parse error - invalid geometry)~~ diff --git a/test/JDBC/expected/alter_proc_recompile-vu-verify.out b/test/JDBC/expected/alter_proc_recompile-vu-verify.out index 88ec23f84d..9a06d8610c 100644 --- a/test/JDBC/expected/alter_proc_recompile-vu-verify.out +++ b/test/JDBC/expected/alter_proc_recompile-vu-verify.out @@ -176,7 +176,7 @@ Query Text: EXEC p_alter_recomp_01 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.150 ms +Babelfish T-SQL Batch Parsing Time: 0.183 ms ~~END~~ execute p_alter_recomp_02 0 -- created with recompile @@ -191,7 +191,7 @@ Query Text: EXEC p_alter_recomp_02 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.079 ms +Babelfish T-SQL Batch Parsing Time: 0.097 ms ~~END~~ execute p_alter_recomp_11 0 -- altered with recompile; for MVU test @@ -206,7 +206,7 @@ Query Text: EXEC p_alter_recomp_11 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.075 ms +Babelfish T-SQL Batch Parsing Time: 0.085 ms ~~END~~ execute p_alter_recomp_12 0 -- altered without recompile; for MVU test @@ -221,7 +221,7 @@ Query Text: EXEC p_alter_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.075 ms +Babelfish T-SQL Batch Parsing Time: 0.081 ms ~~END~~ set babelfish_showplan_all off @@ -244,7 +244,7 @@ Query Text: EXEC p_alter_recomp_01 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.066 ms +Babelfish T-SQL Batch Parsing Time: 0.069 ms ~~END~~ execute p_alter_recomp_02 0 -- created with recompile @@ -259,7 +259,7 @@ Query Text: EXEC p_alter_recomp_02 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.073 ms +Babelfish T-SQL Batch Parsing Time: 0.079 ms ~~END~~ set babelfish_showplan_all off @@ -364,7 +364,7 @@ Query Text: EXEC p_alter_recomp_01 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.067 ms +Babelfish T-SQL Batch Parsing Time: 0.072 ms ~~END~~ execute p_alter_recomp_02 0 -- altered without recompile @@ -379,7 +379,7 @@ Query Text: EXEC p_alter_recomp_02 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.075 ms +Babelfish T-SQL Batch Parsing Time: 0.079 ms ~~END~~ set babelfish_showplan_all off diff --git a/test/JDBC/expected/babel_format_custom_date_time.out b/test/JDBC/expected/babel_format_custom_date_time.out index a6f9326c71..1cebfe44b3 100644 --- a/test/JDBC/expected/babel_format_custom_date_time.out +++ b/test/JDBC/expected/babel_format_custom_date_time.out @@ -4,6 +4,8 @@ DECLARE @curr_date date; SET @curr_date = '12/01/1999'; SELECT FORMAT(@curr_date, 'dd/yy/MM', 'dz-BT'); GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The culture parameter "dz-BT" provided in the function call is not supported.)~~ @@ -54,6 +56,8 @@ DECLARE @curr_datetime datetime; SET @curr_datetime = '1753-01-01 00:00:00.123'; SELECT FORMAT(@curr_datetime, 'dd/yy/MM', 'dz-BT'); GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The culture parameter "dz-BT" provided in the function call is not supported.)~~ @@ -104,6 +108,8 @@ DECLARE @curr_datetime_2 datetime2; SET @curr_datetime_2 = '0001-01-01 00:00:00.123'; SELECT FORMAT(@curr_datetime_2, 'dd/yy/MM', 'dz-BT'); GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The culture parameter "dz-BT" provided in the function call is not supported.)~~ diff --git a/test/JDBC/expected/left-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/left-before-15_8-or-16_4-vu-verify.out index d8b4baed87..ed7d89548e 100644 --- a/test/JDBC/expected/left-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/left-before-15_8-or-16_4-vu-verify.out @@ -688,6 +688,8 @@ abc🙂d DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ @@ -696,6 +698,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ @@ -704,6 +708,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ @@ -712,6 +718,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ diff --git a/test/JDBC/expected/left-vu-verify.out b/test/JDBC/expected/left-vu-verify.out index 78832711ba..0a77159b6d 100644 --- a/test/JDBC/expected/left-vu-verify.out +++ b/test/JDBC/expected/left-vu-verify.out @@ -688,6 +688,8 @@ abc🙂d DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ @@ -696,6 +698,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ @@ -704,6 +708,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ @@ -712,6 +718,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ diff --git a/test/JDBC/expected/ltrim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/ltrim-before-15_8-or-16_4-vu-verify.out index b8b9ce4fca..76e7f84ef1 100644 --- a/test/JDBC/expected/ltrim-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/ltrim-before-15_8-or-16_4-vu-verify.out @@ -553,6 +553,8 @@ abc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ diff --git a/test/JDBC/expected/ltrim-vu-verify.out b/test/JDBC/expected/ltrim-vu-verify.out index de546af507..cb65a74a9a 100644 --- a/test/JDBC/expected/ltrim-vu-verify.out +++ b/test/JDBC/expected/ltrim-vu-verify.out @@ -553,6 +553,8 @@ abc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-before-15_8-or-16_4-vu-verify.out index 028fff54cf..875692b55e 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-before-15_8-or-16_4-vu-verify.out @@ -688,6 +688,8 @@ abc🙂d DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ @@ -696,6 +698,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ @@ -704,6 +708,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ @@ -712,6 +718,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-vu-verify.out index 0f941df9bc..a716f235db 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/left-vu-verify.out @@ -688,6 +688,8 @@ abc🙂d DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ @@ -696,6 +698,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ @@ -704,6 +708,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ @@ -712,6 +718,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-before-15_8-or-16_4-vu-verify.out index d5c3d503c6..000837942e 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-before-15_8-or-16_4-vu-verify.out @@ -553,6 +553,8 @@ abc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-vu-verify.out index 88ad03f724..bc22eeff75 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/ltrim-vu-verify.out @@ -553,6 +553,8 @@ abc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-before-15_8-or-16_4-vu-verify.out index 288621ee44..4f2c84729e 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-before-15_8-or-16_4-vu-verify.out @@ -601,6 +601,8 @@ abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ @@ -609,6 +611,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ @@ -617,6 +621,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ @@ -625,6 +631,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-vu-verify.out index 867377f6cc..487678d933 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/replicate-vu-verify.out @@ -601,6 +601,8 @@ abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ @@ -609,6 +611,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ @@ -617,6 +621,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ @@ -625,6 +631,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-before-15_8-or-16_4-vu-verify.out index a71a9d0565..b9efb57a7f 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-before-15_8-or-16_4-vu-verify.out @@ -545,6 +545,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ @@ -553,6 +555,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ @@ -561,6 +565,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ @@ -569,6 +575,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-vu-verify.out index 99256865d9..9af4688ccc 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/reverse-vu-verify.out @@ -545,6 +545,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ @@ -553,6 +555,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ @@ -561,6 +565,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ @@ -569,6 +575,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-before-15_8-or-16_4-vu-verify.out index 8d2dd65532..4d458af8e2 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-before-15_8-or-16_4-vu-verify.out @@ -659,6 +659,8 @@ ghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ @@ -667,6 +669,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ @@ -675,6 +679,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ @@ -683,6 +689,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-vu-verify.out index d5da998072..7ad571e90d 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/right-vu-verify.out @@ -659,6 +659,8 @@ ghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ @@ -667,6 +669,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ @@ -675,6 +679,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ @@ -683,6 +689,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out index 49fdb73cc2..9d21019d38 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-before-15_8-or-16_4-vu-verify.out @@ -553,6 +553,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-vu-verify.out index f45246480d..afcfd3a7ed 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/rtrim-vu-verify.out @@ -553,6 +553,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-before-15_8-or-16_4-vu-verify.out index df00300dd8..9d96df3e06 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-before-15_8-or-16_4-vu-verify.out @@ -251,6 +251,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -278,6 +280,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -305,6 +309,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -333,6 +339,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -360,6 +368,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -387,6 +397,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -517,6 +529,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -544,6 +558,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -582,6 +598,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -609,6 +627,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -637,6 +657,8 @@ varbinary ~~END~~ +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -665,6 +687,8 @@ varbinary ~~END~~ +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -798,6 +822,8 @@ de DECLARE @inputString date = '2016-12-21'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ @@ -807,6 +833,8 @@ DECLARE @date date = '12-21-16'; DECLARE @inputString datetime = @date; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ @@ -815,6 +843,8 @@ GO DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ @@ -823,6 +853,8 @@ GO DECLARE @inputString time(4) = '12:10:05.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ @@ -831,6 +863,8 @@ GO DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ @@ -839,6 +873,8 @@ GO DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ @@ -847,6 +883,8 @@ GO DECLARE @inputString decimal = 123456; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ @@ -855,6 +893,8 @@ GO DECLARE @inputString numeric = 12345.12; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ @@ -863,6 +903,8 @@ GO DECLARE @inputString float = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ @@ -871,6 +913,8 @@ GO DECLARE @inputString real = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ @@ -879,6 +923,8 @@ GO DECLARE @inputString bigint = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ @@ -887,6 +933,8 @@ GO DECLARE @inputString int = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ @@ -895,6 +943,8 @@ GO DECLARE @inputString smallint = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ @@ -903,6 +953,8 @@ GO DECLARE @inputString tinyint = 235; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ @@ -911,6 +963,8 @@ GO DECLARE @inputString money = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ @@ -919,6 +973,8 @@ GO DECLARE @inputString smallmoney = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ @@ -927,6 +983,8 @@ GO DECLARE @inputString bit = 1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ @@ -935,6 +993,8 @@ GO DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ @@ -1056,6 +1116,8 @@ bc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ @@ -1064,6 +1126,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ @@ -1072,6 +1136,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ @@ -1080,6 +1146,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-vu-verify.out index b3a2766835..c331ce56ea 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/substring-vu-verify.out @@ -256,6 +256,8 @@ varchar DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -296,6 +298,8 @@ varchar DECLARE @inputString CHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -336,6 +340,8 @@ varchar DECLARE @inputString CHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -377,6 +383,8 @@ varchar DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -417,6 +425,8 @@ varchar DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -457,6 +467,8 @@ varchar DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -600,6 +612,8 @@ nvarchar DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -640,6 +654,8 @@ nvarchar DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -691,6 +707,8 @@ nvarchar DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -731,6 +749,8 @@ nvarchar DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -772,6 +792,8 @@ varbinary DECLARE @inputString BINARY(10) = 0x6162636465666768 SELECT substring(@inputString, 2, -1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -813,6 +835,8 @@ varbinary DECLARE @inputString VARBINARY(10) = 0x6162636465666768 SELECT substring(@inputString, 2, -1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -954,6 +978,8 @@ de DECLARE @inputString date = '2016-12-21'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ @@ -963,6 +989,8 @@ DECLARE @date date = '12-21-16'; DECLARE @inputString datetime = @date; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ @@ -971,6 +999,8 @@ GO DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ @@ -979,6 +1009,8 @@ GO DECLARE @inputString time(4) = '12:10:05.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ @@ -987,6 +1019,8 @@ GO DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ @@ -995,6 +1029,8 @@ GO DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ @@ -1003,6 +1039,8 @@ GO DECLARE @inputString decimal = 123456; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ @@ -1011,6 +1049,8 @@ GO DECLARE @inputString numeric = 12345.12; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ @@ -1019,6 +1059,8 @@ GO DECLARE @inputString float = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ @@ -1027,6 +1069,8 @@ GO DECLARE @inputString real = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ @@ -1035,6 +1079,8 @@ GO DECLARE @inputString bigint = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ @@ -1043,6 +1089,8 @@ GO DECLARE @inputString int = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ @@ -1051,6 +1099,8 @@ GO DECLARE @inputString smallint = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ @@ -1059,6 +1109,8 @@ GO DECLARE @inputString tinyint = 235; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ @@ -1067,6 +1119,8 @@ GO DECLARE @inputString money = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ @@ -1075,6 +1129,8 @@ GO DECLARE @inputString smallmoney = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ @@ -1083,6 +1139,8 @@ GO DECLARE @inputString bit = 1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ @@ -1091,6 +1149,8 @@ GO DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ @@ -1212,6 +1272,8 @@ bc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ @@ -1220,6 +1282,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ @@ -1228,6 +1292,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ @@ -1236,6 +1302,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-before-15_8-or-16_4-vu-verify.out index 40b420686e..f2f7c18cfd 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-before-15_8-or-16_4-vu-verify.out @@ -654,6 +654,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -694,6 +696,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -702,6 +706,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -751,6 +757,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -791,6 +799,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -799,6 +809,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1013,6 +1025,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1021,6 +1035,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1061,6 +1077,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1069,6 +1087,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1118,6 +1138,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1167,6 +1189,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1372,6 +1396,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1380,6 +1406,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1420,6 +1448,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1428,6 +1458,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1477,6 +1509,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1526,6 +1560,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1731,6 +1767,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1739,6 +1777,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1779,6 +1819,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1787,6 +1829,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1836,6 +1880,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1885,6 +1931,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-vu-verify.out index ef9bbc5a4e..a42c42b04f 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/translate-vu-verify.out @@ -654,6 +654,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -694,6 +696,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -702,6 +706,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -751,6 +757,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -791,6 +799,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -799,6 +809,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1013,6 +1025,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1021,6 +1035,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1061,6 +1077,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1069,6 +1087,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1118,6 +1138,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1167,6 +1189,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1372,6 +1396,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1380,6 +1406,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1420,6 +1448,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1428,6 +1458,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1477,6 +1509,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1526,6 +1560,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1731,6 +1767,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1739,6 +1777,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1779,6 +1819,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1787,6 +1829,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1836,6 +1880,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1885,6 +1931,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-before-15_8-or-16_4-vu-verify.out index 82b27a0d8a..ab9b200b54 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-before-15_8-or-16_4-vu-verify.out @@ -530,6 +530,8 @@ DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_ SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ @@ -539,6 +541,8 @@ DECLARE @myid xml = CAST ('' AS xml) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ @@ -548,6 +552,8 @@ DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ @@ -815,6 +821,8 @@ adjnfjh declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) select upper(@b) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-vu-verify.out b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-vu-verify.out index 35d13a4633..4d192c75f8 100644 --- a/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/upper_lower-vu-verify.out @@ -530,6 +530,8 @@ DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_ SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ @@ -539,6 +541,8 @@ DECLARE @myid xml = CAST ('' AS xml) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ @@ -548,6 +552,8 @@ DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ @@ -839,6 +845,8 @@ adjnfjh declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) select upper(@b) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/left-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/left-vu-verify.out index 08eacfbc41..42569cab00 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/left-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/left-vu-verify.out @@ -688,6 +688,8 @@ abc🙂d DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of left function.)~~ @@ -696,6 +698,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of left function.)~~ @@ -704,6 +708,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of left function.)~~ @@ -712,6 +718,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LEFT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of left function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/ltrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/ltrim-vu-verify.out index 9d48cccb44..b9e14a0deb 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/ltrim-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/ltrim-vu-verify.out @@ -553,6 +553,8 @@ abc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of ltrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of ltrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of ltrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT LTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of ltrim function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-vu-verify.out index 6b996b7965..c6827d00c2 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/replicate-vu-verify.out @@ -601,6 +601,8 @@ abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ @@ -609,6 +611,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ @@ -617,6 +621,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ @@ -625,6 +631,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-vu-verify.out index 855705d732..1e079cd2c3 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/reverse-vu-verify.out @@ -545,6 +545,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ @@ -553,6 +555,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ @@ -561,6 +565,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ @@ -569,6 +575,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-vu-verify.out index 0d822e07f0..d19a70b993 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/right-vu-verify.out @@ -659,6 +659,8 @@ ghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ @@ -667,6 +669,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ @@ -675,6 +679,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ @@ -683,6 +689,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-vu-verify.out index ca5eeff5d9..b01d4d2078 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/rtrim-vu-verify.out @@ -553,6 +553,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-vu-verify.out index 63af8f789b..18d66c6b3b 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/substring-vu-verify.out @@ -256,6 +256,8 @@ varchar DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -296,6 +298,8 @@ varchar DECLARE @inputString CHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -336,6 +340,8 @@ varchar DECLARE @inputString CHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -377,6 +383,8 @@ varchar DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -417,6 +425,8 @@ varchar DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -457,6 +467,8 @@ varchar DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -600,6 +612,8 @@ nvarchar DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -640,6 +654,8 @@ nvarchar DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -691,6 +707,8 @@ nvarchar DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -731,6 +749,8 @@ nvarchar DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -772,6 +792,8 @@ varbinary DECLARE @inputString BINARY(10) = 0x6162636465666768 SELECT substring(@inputString, 2, -1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -813,6 +835,8 @@ varbinary DECLARE @inputString VARBINARY(10) = 0x6162636465666768 SELECT substring(@inputString, 2, -1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -954,6 +978,8 @@ de DECLARE @inputString date = '2016-12-21'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ @@ -963,6 +989,8 @@ DECLARE @date date = '12-21-16'; DECLARE @inputString datetime = @date; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ @@ -971,6 +999,8 @@ GO DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ @@ -979,6 +1009,8 @@ GO DECLARE @inputString time(4) = '12:10:05.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ @@ -987,6 +1019,8 @@ GO DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ @@ -995,6 +1029,8 @@ GO DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ @@ -1003,6 +1039,8 @@ GO DECLARE @inputString decimal = 123456; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ @@ -1011,6 +1049,8 @@ GO DECLARE @inputString numeric = 12345.12; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ @@ -1019,6 +1059,8 @@ GO DECLARE @inputString float = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ @@ -1027,6 +1069,8 @@ GO DECLARE @inputString real = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ @@ -1035,6 +1079,8 @@ GO DECLARE @inputString bigint = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ @@ -1043,6 +1089,8 @@ GO DECLARE @inputString int = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ @@ -1051,6 +1099,8 @@ GO DECLARE @inputString smallint = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ @@ -1059,6 +1109,8 @@ GO DECLARE @inputString tinyint = 235; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ @@ -1067,6 +1119,8 @@ GO DECLARE @inputString money = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ @@ -1075,6 +1129,8 @@ GO DECLARE @inputString smallmoney = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ @@ -1083,6 +1139,8 @@ GO DECLARE @inputString bit = 1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ @@ -1091,6 +1149,8 @@ GO DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ @@ -1212,6 +1272,8 @@ bc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ @@ -1220,6 +1282,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ @@ -1228,6 +1292,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ @@ -1236,6 +1302,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-vu-verify.out index 258cee2c7f..64ba5d69e2 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/translate-vu-verify.out @@ -576,6 +576,8 @@ varchar DECLARE @inputString CHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -653,6 +655,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -693,6 +697,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -701,6 +707,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -750,6 +758,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -790,6 +800,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -798,6 +810,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -907,6 +921,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -942,6 +958,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1010,6 +1028,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1018,6 +1038,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1058,6 +1080,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1066,6 +1090,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1115,6 +1141,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1164,6 +1192,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1273,6 +1303,8 @@ nvarchar DECLARE @inputString NCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1368,6 +1400,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1376,6 +1410,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1416,6 +1452,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1424,6 +1462,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1473,6 +1513,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1522,6 +1564,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1631,6 +1675,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters CHAR(20) = '比拉斯 ', @translations CHAR(20) = '尔·比?' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1693,6 +1739,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = N' 比尔·拉莫斯 ', @characters NCHAR(20) = N'比拉斯 ', @translations NCHAR(20) = N'尔·比?' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1725,6 +1773,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1733,6 +1783,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1773,6 +1825,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1781,6 +1835,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1830,6 +1886,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1879,6 +1937,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ diff --git a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/upper_lower-vu-verify.out b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/upper_lower-vu-verify.out index 26adc8e18f..2988e433e5 100644 --- a/test/JDBC/expected/non_default_server_collation/japanese_ci_as/upper_lower-vu-verify.out +++ b/test/JDBC/expected/non_default_server_collation/japanese_ci_as/upper_lower-vu-verify.out @@ -530,6 +530,8 @@ DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_ SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ @@ -539,6 +541,8 @@ DECLARE @myid xml = CAST ('' AS xml) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ @@ -548,6 +552,8 @@ DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ @@ -838,6 +844,8 @@ adjnfjh declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) select upper(@b) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ diff --git a/test/JDBC/expected/parallel_query/BABEL-2844.out b/test/JDBC/expected/parallel_query/BABEL-2844.out index d4ec0b3755..86d2755dcd 100644 --- a/test/JDBC/expected/parallel_query/BABEL-2844.out +++ b/test/JDBC/expected/parallel_query/BABEL-2844.out @@ -21,7 +21,7 @@ Query Text: create table babel_2844_t1 (a1 int, b1 int); ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 63.926 ms +Babelfish T-SQL Batch Parsing Time: 64.356 ms ~~END~~ select * from babel_2844_t1 where b1 = 1; @@ -42,7 +42,7 @@ Function Scan on set_config (cost=0.00..0.01 rows=1 width=32) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 23.541 ms +Babelfish T-SQL Batch Parsing Time: 24.000 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -79,7 +79,7 @@ Insert on babel_2844_t1 (cost=0.00..0.01 rows=0 width=0) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.175 ms +Babelfish T-SQL Batch Parsing Time: 0.178 ms ~~END~~ insert into babel_2844_t2 select * from babel_2844_t1 where a1 = 1; @@ -94,7 +94,7 @@ Insert on babel_2844_t2 (cost=0.00..38.25 rows=0 width=0) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.550 ms +Babelfish T-SQL Batch Parsing Time: 0.580 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -129,7 +129,7 @@ Gather (cost=0.00..0.01 rows=1 width=4) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.158 ms +Babelfish T-SQL Batch Parsing Time: 0.161 ms ~~END~~ select * from babel_2844_t1 where b1 = 1; @@ -145,7 +145,7 @@ Gather (cost=0.00..19.11 rows=11 width=8) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.200 ms +Babelfish T-SQL Batch Parsing Time: 0.205 ms ~~END~~ @@ -174,7 +174,7 @@ Gather (cost=0.00..19.11 rows=11 width=8) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.109 ms +Babelfish T-SQL Batch Parsing Time: 0.145 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -201,7 +201,7 @@ Gather (cost=0.00..19.11 rows=11 width=8) ~~START~~ text -[ "Babelfish T-SQL Batch Parsing Time": 0.118] +Babelfish T-SQL Batch Parsing Time: 0.126 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -227,7 +227,7 @@ Gather (cost=0.00..19.11 rows=11 width=8) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.228 +Babelfish T-SQL Batch Parsing Time: 0.241 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -268,7 +268,7 @@ Gather (cost=0.00..17.29 rows=2260 width=8) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 10.543 ms +Babelfish T-SQL Batch Parsing Time: 10.599 ms ~~END~~ @@ -313,7 +313,7 @@ Query Text: EXEC babel_2844_proc 3 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 25.537 ms +Babelfish T-SQL Batch Parsing Time: 25.709 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -341,7 +341,7 @@ Query Text: EXEC SP_PREPARE @handle OUT, NULL, 'select * from babel_2844_t1' ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 27.045 ms +Babelfish T-SQL Batch Parsing Time: 26.758 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -366,7 +366,7 @@ Function Scan on babel_2844_itvf (cost=0.25..10.25 rows=1000 width=8) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.134 ms +Babelfish T-SQL Batch Parsing Time: 0.138 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -395,7 +395,7 @@ Function Scan on babel_2844_mstvf (cost=0.25..10.25 rows=1000 width=8) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.103 ms +Babelfish T-SQL Batch Parsing Time: 0.115 ms ~~END~~ set BABELFISH_SHOWPLAN_ALL OFF; @@ -445,7 +445,7 @@ Query Text: set BABELFISH_STATISTICS PROFILE ON; ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 3.448 ms +Babelfish T-SQL Batch Parsing Time: 3.442 ms ~~END~~ @@ -483,7 +483,7 @@ Query Text: SELECT * INTO t3 FROM t1 WHERE t1.b = 1 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 30.196 ms +Babelfish T-SQL Batch Parsing Time: 31.453 ms ~~END~~ @@ -507,7 +507,7 @@ Insert on t1 (cost=0.00..0.04 rows=0 width=0) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.141 ms +Babelfish T-SQL Batch Parsing Time: 0.142 ms ~~END~~ @@ -523,7 +523,7 @@ Delete on t1 (cost=0.15..8.17 rows=0 width=0) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 57.541 ms +Babelfish T-SQL Batch Parsing Time: 60.549 ms ~~END~~ @@ -539,7 +539,7 @@ Update on t1 (cost=0.15..8.17 rows=0 width=0) ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 46.745 ms +Babelfish T-SQL Batch Parsing Time: 49.259 ms ~~END~~ @@ -563,7 +563,7 @@ END ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 35.848 ms +Babelfish T-SQL Batch Parsing Time: 35.948 ms ~~END~~ diff --git a/test/JDBC/expected/parallel_query/alter_proc_recompile-vu-verify.out b/test/JDBC/expected/parallel_query/alter_proc_recompile-vu-verify.out index 093a9355ef..a54e7435ae 100644 --- a/test/JDBC/expected/parallel_query/alter_proc_recompile-vu-verify.out +++ b/test/JDBC/expected/parallel_query/alter_proc_recompile-vu-verify.out @@ -179,7 +179,7 @@ Query Text: EXEC p_alter_recomp_01 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.199 ms +Babelfish T-SQL Batch Parsing Time: 0.223 ms ~~END~~ execute p_alter_recomp_02 0 -- created with recompile @@ -197,7 +197,7 @@ Query Text: EXEC p_alter_recomp_02 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.100 ms +Babelfish T-SQL Batch Parsing Time: 0.104 ms ~~END~~ execute p_alter_recomp_11 0 -- altered with recompile; for MVU test @@ -215,7 +215,7 @@ Query Text: EXEC p_alter_recomp_11 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.081 ms +Babelfish T-SQL Batch Parsing Time: 0.123 ms ~~END~~ execute p_alter_recomp_12 0 -- altered without recompile; for MVU test @@ -233,7 +233,7 @@ Query Text: EXEC p_alter_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.075 ms +Babelfish T-SQL Batch Parsing Time: 0.118 ms ~~END~~ set babelfish_showplan_all off @@ -259,7 +259,7 @@ Query Text: EXEC p_alter_recomp_01 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.067 ms +Babelfish T-SQL Batch Parsing Time: 0.071 ms ~~END~~ execute p_alter_recomp_02 0 -- created with recompile @@ -277,7 +277,7 @@ Query Text: EXEC p_alter_recomp_02 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.074 ms +Babelfish T-SQL Batch Parsing Time: 0.115 ms ~~END~~ set babelfish_showplan_all off @@ -385,7 +385,7 @@ Query Text: EXEC p_alter_recomp_01 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.113 ms +Babelfish T-SQL Batch Parsing Time: 0.122 ms ~~END~~ execute p_alter_recomp_02 0 -- altered without recompile @@ -403,7 +403,7 @@ Query Text: EXEC p_alter_recomp_02 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.110 ms +Babelfish T-SQL Batch Parsing Time: 0.099 ms ~~END~~ set babelfish_showplan_all off diff --git a/test/JDBC/expected/parallel_query/test_dynamic_local_vars.out b/test/JDBC/expected/parallel_query/test_dynamic_local_vars.out new file mode 100644 index 0000000000..52c77265b4 --- /dev/null +++ b/test/JDBC/expected/parallel_query/test_dynamic_local_vars.out @@ -0,0 +1,1566 @@ +-- simple vars +declare @i int +declare @j int +set @i = 10 +set @j = @i + 10 +select @i, @j +GO +~~START~~ +int#!#int +10#!#20 +~~END~~ + + +declare @i int +declare @j int +select @i = 10, @j = @i + 10 +select @i, @j +GO +~~START~~ +int#!#int +10#!#20 +~~END~~ + + +declare @i int +declare @j int = 0; +select @i = 10, @j = @i + @j * 2 +select @i, @j +GO +~~START~~ +int#!#int +10#!#10 +~~END~~ + + +declare @i int +declare @j int +select @i = 10, @j = @i + 10 +select @j += 10 +select @i, @j +GO +~~START~~ +int#!#int +10#!#30 +~~END~~ + + +-- should throw an error +declare @i int +select @i = 0, @i += 2 +select @i +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Babelfish does not support assignment to the same variable in SELECT. variable name: "@i")~~ + + +declare @i int +select @i = 10, @i += 10 +select @i +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Babelfish does not support assignment to the same variable in SELECT. variable name: "@i")~~ + + +-- sub-expr +declare @i int +set @i = 10 +select @i += (5 - 1) +select @i +GO +~~START~~ +int +14 +~~END~~ + + +DECLARE @a int +select @a = (select ~cast('1' as int)) +select @a +go +~~START~~ +int +-2 +~~END~~ + + + +DECLARE @Counter INT = 1; +DECLARE @MaxValue INT = 10; +WHILE @Counter <= @MaxValue +BEGIN + DECLARE @IsEven BIT; + + IF @Counter % 2 = 0 + SET @IsEven = 1; + ELSE + SET @IsEven = 0; + + IF @IsEven = 1 + SELECT CAST(@Counter AS VARCHAR(2)) + ' is even'; + ELSE + SELECT CAST(@Counter AS VARCHAR(2)) + ' is odd'; + + SET @Counter = @Counter + 1; +END; +GO +~~START~~ +varchar +1 is odd +~~END~~ + +~~START~~ +varchar +2 is even +~~END~~ + +~~START~~ +varchar +3 is odd +~~END~~ + +~~START~~ +varchar +4 is even +~~END~~ + +~~START~~ +varchar +5 is odd +~~END~~ + +~~START~~ +varchar +6 is even +~~END~~ + +~~START~~ +varchar +7 is odd +~~END~~ + +~~START~~ +varchar +8 is even +~~END~~ + +~~START~~ +varchar +9 is odd +~~END~~ + +~~START~~ +varchar +10 is even +~~END~~ + + +declare @a numeric (10, 4); +declare @b numeric (10, 4); +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO +~~START~~ +numeric#!#numeric +100.4100#!#200.8200 +~~END~~ + +~~START~~ +numeric +301.2300 +~~END~~ + + +declare @a numeric; +declare @b numeric (10, 4); +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO +~~START~~ +numeric#!#numeric +100#!#200.8200 +~~END~~ + +~~START~~ +numeric +300.8200 +~~END~~ + + +declare @a varbinary +set @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +74 +~~END~~ + + +declare @a varbinary(max) +set @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +746573745F62696E +~~END~~ + + +declare @a varbinary(10) +set @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +746573745F62696E +~~END~~ + + +declare @a varbinary +declare @b varbinary +select @a = cast('test_bin' as varbinary), @b = @a +select @a, @b +GO +~~START~~ +varbinary#!#varbinary +74#!#74 +~~END~~ + + +declare @a varbinary(max) +select @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +746573745F62696E +~~END~~ + + +DECLARE @a varchar +set @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +1#!#1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @v varchar(20); +SELECT @v = NULL; +SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) +GO +~~START~~ +int#!#int#!#int +0#!##!# +~~END~~ + + +DECLARE @a varchar(max) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +-- collate can not be used with local variables +DECLARE @v varchar(20) collate BBF_Unicode_CP1_CI_As = 'ci_as'; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'collate' at line 2 and character position 23)~~ + + +declare @source int; +declare @target sql_variant; +select @source = 1.0 +select @target = cast(@source as varchar(10)); +SELECT sql_variant_property(@target, 'basetype'); +select @target +GO +~~START~~ +sql_variant +varchar +~~END~~ + +~~START~~ +sql_variant +1 +~~END~~ + + +declare @source int; +declare @target varchar(10); +select @source = 1.0 +select cast(@source as varchar(10)) +select @target = cast(@source as varchar(10)); +select @target +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @a pg_catalog.varchar +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DECLARE @a pg_catalog.varchar(100) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DECLARE @a pg_catalog.varchar(10) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +10#!#10 +~~END~~ + +~~START~~ +varchar +1234567890 +~~END~~ + + +DECLARE @a varchar +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +1#!#1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @a varchar(100) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DECLARE @a varchar(10) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +10#!#10 +~~END~~ + +~~START~~ +varchar +1234567890 +~~END~~ + + +DECLARE @a int +set @a = 0 +select @a ^= 1 +select @a +go +~~START~~ +int +1 +~~END~~ + + +DECLARE @a int +set @a = 0 +select @a += ~@a +select @a +go +~~START~~ +int +-1 +~~END~~ + + +SET QUOTED_IDENTIFIER OFF +GO + +-- quoted identifiers +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += "a""b''c'd", @v2 += "x""y''z"; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCa"b''c'd#!#XYZx"y''z +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += "a""b''c'd", @v2 += @v + "x""y''z"; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCa"b''c'd#!#XYZABCa"b''c'dx"y''z +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += @v + "x""y''z"; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCd'c''b"a#!#XYZABCd'c''b"ax"y''z +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += @v + reverse("x""y''z"); +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCd'c''b"a#!#XYZABCd'c''b"az''y"x +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += REVERSE( @v + reverse("x""y''z")); +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCd'c''b"a#!#XYZx"y''za"b''c'dCBA +~~END~~ + + +SET QUOTED_IDENTIFIER ON +GO + +declare @v varchar(20) = 'ABC', @v2 varchar(20)='XYZ'; +select @v += 'abc', @v2 += 'xyz'; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCabc#!#XYZxyz +~~END~~ + + +declare @a int = 1, @b int = 2; +select @a = 2, @b = @a + 2 +select @a, @b +GO +~~START~~ +int#!#int +2#!#4 +~~END~~ + + +declare @a int = 1, @b int = 2; +select @a += 2, @b -= @a + 2 +select @a, @b +GO +~~START~~ +int#!#int +3#!#-3 +~~END~~ + + +-- xml methods +DECLARE @a bit = 1 +DECLARE @xml XML = ' ' +SELECT @a |= @xml.exist('/artists/artist/@name') +select @a +GO +~~START~~ +bit +1 +~~END~~ + + +DECLARE @a bit = 1 +DECLARE @xml XML; +SELECT @xml = ' ', @a |= @xml.exist('/artists/artist/@name') +select @a +GO +~~START~~ +bit +1 +~~END~~ + + +-- test all kind of udts +create type udt from NCHAR +go + +declare @a udt +select @a = 'anc' +select @a +GO +~~START~~ +nchar +a +~~END~~ + + +DROP type udt +GO + +create type varchar_max from varchar(max) +GO + +DECLARE @a varchar_max +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DROP type varchar_max +GO + +create type num_def from numeric +GO + +declare @a numeric; +declare @b num_def; +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO +~~START~~ +numeric#!#numeric +100#!#201 +~~END~~ + +~~START~~ +numeric +301 +~~END~~ + + +drop type num_def +GO + +/* + * select/update test + */ +create table local_var_tst (id int) +GO + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (6) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- txn does not affect local variables +begin tran +declare @i int +update local_var_tst set id = 5, @i = id * 5 +select @i +ROLLBACK tran +select @i +GO +~~ROW COUNT: 3~~ + +~~START~~ +int +25 +~~END~~ + +~~START~~ +int +25 +~~END~~ + + +select * from local_var_tst; +GO +~~START~~ +int +1 +2 +6 +~~END~~ + + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- should return 4 +declare @i int +select @i = 1 +select @i = id * 2 from local_var_tst where id = @i +select @i +GO +~~START~~ +int +2 +~~END~~ + + +declare @i int +select @i = 1 +select @i = @i + id * 2 from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +declare @i int +select @i = 1 +select @i = id * 2 + @i from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +declare @i int +select @i = 1 +select @i += id * 2 from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +-- 3 parts name +declare @i int +select @i = 1 +select @i += master.dbo.local_var_tst.id * 2 from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +-- local var name same as column +declare @id int = 1 +select @id += master.dbo.local_var_tst.id * 2 from local_var_tst +select @id +GO +~~START~~ +int +7 +~~END~~ + + +-- should throw an error +declare @i int +declare @j int +set @i = 10 +set @j = 0; +select @i += (select @j = @j + id from local_var_tst) +select @i +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: variable assignment can be used only in top-level SELECT)~~ + + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +DECLARE @ans INT +SELECT @ans = AVG(id) FROM local_var_tst +select @ans +GO +~~START~~ +int +1 +~~END~~ + + +-- local variable inside functions +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + SELECT @ans = AVG(id) FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func(); +GO +~~START~~ +int +1 +~~END~~ + + +DROP FUNCTION var_inside_func(); +GO + +-- show throw an error +CREATE FUNCTION var_inside_func() +RETURNS @tab table (a int) as +BEGIN + DECLARE @ans INT + SELECT @ans += id from local_var_tst + select @ans +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: SELECT statement returning result to a client cannot be used in a function)~~ + + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + SELECT @ans += id FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func() +go +~~START~~ +int + +~~END~~ + + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func(@def int) +RETURNS INT AS +BEGIN + DECLARE @ans INT; + select @ans = @def; + SELECT @ans += id FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func(0) +go +~~START~~ +int +3 +~~END~~ + + +declare @def int = 1; +select var_inside_func(@def) +go +~~START~~ +int +4 +~~END~~ + + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + select @ans = 0 + SELECT @ans += id + @ans FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func() +go +~~START~~ +int +4 +~~END~~ + + +drop function if exists var_inside_func +go + +-- variable with procedure +CREATE PROCEDURE var_with_procedure (@a numeric(10,4) OUTPUT) AS +BEGIN + SET @a=100.41; + select @a as a; +END; +GO + +exec var_with_procedure 2.000; +GO +~~START~~ +numeric +100.4100 +~~END~~ + + +-- value of @out should remain 2.000 +declare @out numeric(10,4); +set @out = 2.000; +exec var_with_procedure 2.000; +select @out +GO +~~START~~ +numeric +100.4100 +~~END~~ + +~~START~~ +numeric +2.0000 +~~END~~ + + +drop procedure var_with_procedure; +GO + +CREATE PROCEDURE var_with_procedure_1 (@a numeric(10,4) OUTPUT, @b numeric(10,4) OUTPUT) AS +BEGIN + SET @a=100.41; + SET @b=200.82; + select @a+@b as r; +END; +GO + +EXEC var_with_procedure_1 2.000, 3.000; +GO +~~START~~ +numeric +301.2300 +~~END~~ + + +-- value of @a should be 100 +DECLARE @a INT; +EXEC var_with_procedure_1 @a OUT, 3.000; +SELECT @a; +GO +~~START~~ +numeric +301.2300 +~~END~~ + +~~START~~ +int +100 +~~END~~ + + +drop procedure var_with_procedure_1; +GO + +CREATE PROCEDURE var_with_procedure_2 +AS +BEGIN + declare @a int + declare @b int + set @a = 1 + return + select @b=@a+1 +END +GO + +exec var_with_procedure_2 +GO + +DROP PROCEDURE var_with_procedure_2 +GO + +-- insert testing with local variables +truncate table dbo.local_var_tst +go + +-- should throw an error +declare @a int = 1 +insert into local_var_tst select @a = @a + 1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: variable assignment can be used only in top-level SELECT)~~ + + +-- syntax error +declare @a int = 1 +insert into local_var_tst values (@a = @a + 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 3 and character position 37)~~ + + +declare @a int = 1 +insert into local_var_tst values (@a + 1) +GO +~~ROW COUNT: 1~~ + + +-- output clause with insert +declare @a int = 1 +declare @mytbl table(a int) +insert local_var_tst output inserted.id into @mytbl values (@a + 1) +select * from @mytbl +GO +~~ROW COUNT: 1~~ + +~~START~~ +int +2 +~~END~~ + + +-- output clause with delete +declare @a int = 1 +declare @mytbl table(a int) +delete local_var_tst output deleted.id into @mytbl where id = @a + 1 +select * from @mytbl +GO +~~ROW COUNT: 2~~ + +~~START~~ +int +2 +2 +~~END~~ + + +drop table dbo.local_var_tst +go + +create table local_var_tst_1 (a int, b int) +GO + +insert into local_var_tst_1 values (1,3), (2, 4) +go +~~ROW COUNT: 2~~ + + + +-- select test with multi-variable assignment +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += b from local_var_tst_1 +select @a, @b +go +~~START~~ +int#!#int +3#!#7 +~~END~~ + + +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += @a + b from local_var_tst_1 +select @a, @b +go +~~START~~ +int#!#int +3#!#11 +~~END~~ + + +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += @a + ~b from local_var_tst_1 +select @a, @b +go +~~START~~ +int#!#int +3#!#-5 +~~END~~ + + +drop table local_var_tst_1 +go + +create table local_var_str_tst (id varchar(100)) +GO + +insert into local_var_str_tst values ('abc'), (' '), ('def') +GO +~~ROW COUNT: 3~~ + + +declare @i varchar(1000) +set @i = '' +select @i = @i + id from local_var_str_tst +select @i +go +~~START~~ +varchar +abc def +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i = id + @i from local_var_str_tst +select @i +go +~~START~~ +varchar +def abc +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i += id from local_var_str_tst +select @i +go +~~START~~ +varchar +abc def +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i = reverse(@i + 'id') from local_var_str_tst +select @i +go +~~START~~ +varchar +didiid +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i += reverse(id) from local_var_str_tst +select @i +go +~~START~~ +varchar +cba fed +~~END~~ + + +declare @i varchar(1000) +set @i = 'abc' +select @i = reverse(@i) +select @i +go +~~START~~ +varchar +cba +~~END~~ + + +-- function call like trim, ltrim, etc will be rewritten by ANTLR +declare @i varchar(1000) +set @i = ' ' +select @i += id from local_var_str_tst +select len(@i), @i +select @i = trim(@i) +select len(@i), @i +go +~~START~~ +int#!#varchar +8#!# abc def +~~END~~ + +~~START~~ +int#!#varchar +7#!#abc def +~~END~~ + + +drop table local_var_str_tst; +go + +-- $PARTITION is rewritten by ANTLR +CREATE PARTITION FUNCTION RangePF1 ( INT ) +AS RANGE RIGHT FOR VALUES (10, 100, 1000) ; +GO + +declare @res int = -1; +SELECT @res = $PARTITION.RangePF1 (10); +select @res +select 1 where @res = $PARTITION.RangePF1 (10); +SELECT @res = $PARTITION.RangePF1 (@res); +select @res +GO +~~START~~ +int +2 +~~END~~ + +~~START~~ +int +1 +~~END~~ + +~~START~~ +int +1 +~~END~~ + + +DROP PARTITION FUNCTION RangePF1 +GO + +CREATE SEQUENCE CountBy1 + START WITH 1 + INCREMENT BY 1 ; +GO + +-- NEXT VALUE FOR gets re-written by ANTLR +DECLARE @myvar1 BIGINT = NEXT VALUE FOR CountBy1 ; +DECLARE @myvar2 BIGINT ; +DECLARE @myvar3 BIGINT ; +select @myvar2 = NEXT VALUE FOR CountBy1 ; +SELECT @myvar3 = NEXT VALUE FOR CountBy1 ; +SELECT @myvar1 AS myvar1, @myvar2 AS myvar2, @myvar3 AS myvar3 ; +GO +~~START~~ +bigint#!#bigint#!#bigint +1#!#2#!#3 +~~END~~ + + +DROP SEQUENCE CountBy1 +GO + +-- any @@ is also re-written by ANTLR +declare @pid int = 0 +select @pid += @@spid +select 1 where @pid = @@spid +go +~~START~~ +int +1 +~~END~~ + + +-- float point notation also gets rewritten by ANTLR e.g., 2.1E, -.2e+, -2.e- +declare @a float = 0 +select @a = 2.1E +select @a +select @a = -.2e+ +select @a +select @a = -2.e- +select @a +go +~~START~~ +float +2.1 +~~END~~ + +~~START~~ +float +-0.2 +~~END~~ + +~~START~~ +float +-2.0 +~~END~~ + + +-- variables only in select target list shows dynamic behavior +create table local_var_tst (id int) +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (1) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +declare @i int = 1 +declare @j int = 0 +select @j += id, @i = id + 1 from local_var_tst where id = @i +select @i, @j +go +~~START~~ +int#!#int +2#!#2 +~~END~~ + + +declare @i int = 1 +select @i = id * 2 from local_var_tst where id = @i +select @i +GO +~~START~~ +int +2 +~~END~~ + + + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +set babelfish_statistics profile On; +GO + +declare @i int = 1 +declare @j int = 0 +select @j += id, @i = id + 1 from local_var_tst where id = @i +select @i, @j +go +~~START~~ +text +Query Text: select sys.pltsql_assign_var(3, @j + cast((id) as int)), sys.pltsql_assign_var(2, cast((id + 1) as int)) from local_var_tst where id = "@i" +Seq Scan on local_var_tst (cost=0.00..42.01 rows=13 width=8) (actual rows=2 loops=1) + Filter: (id = 1) + Rows Removed by Filter: 1 +~~END~~ + +~~START~~ +int#!#int +2#!#2 +~~END~~ + +~~START~~ +text +Query Text: select "@i", "@j" +Gather (cost=0.00..0.01 rows=1 width=8) (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Result (cost=0.00..0.01 rows=1 width=8) (actual rows=1 loops=1) +~~END~~ + + +declare @i int = 1 +select @i = @i * 2 from local_var_tst where id = @i +select @i +GO +~~START~~ +text +Query Text: select sys.pltsql_assign_var(2, cast((@i * 2) as int)) from local_var_tst where id = "@i" +Seq Scan on local_var_tst (cost=0.00..41.94 rows=13 width=4) (actual rows=2 loops=1) + Filter: (id = 1) + Rows Removed by Filter: 1 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: select "@i" +Gather (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1) + Workers Planned: 1 + Workers Launched: 1 + Single Copy: true + -> Result (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1) +~~END~~ + + +set babelfish_statistics profile OFF +GO + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +-- declared variable name with length > 63 +declare @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr += 1 +select @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +2 +~~END~~ + + +-- variable names starting with @@ +declare @@a int = 1; +select @@a = @@a + 1 +select @@a +GO +~~START~~ +int +2 +~~END~~ + + +declare @@a int = 1; +select @@a += 1 +select @@a +GO +~~START~~ +int +2 +~~END~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr + 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +2 +~~END~~ + + +truncate table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (1) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr + id from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +5 +~~END~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = id + @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +5 +~~END~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr += id from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +5 +~~END~~ + + +truncate table local_var_tst +GO + +insert into local_var_tst values (1) +GO +~~ROW COUNT: 1~~ + + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +set babelfish_statistics profile On; +GO + +-- error while evaluating const expression +declare @a int = 1; +select @a = 1 / 0 from local_var_tst +select * from local_var_tst where id = @a +GO +~~ERROR (Code: 8134)~~ + +~~ERROR (Message: division by zero)~~ + +~~START~~ +int +1 +~~END~~ + +~~START~~ +text +Query Text: select * from local_var_tst where id = "@a" +Gather (cost=0.00..20.28 rows=13 width=4) (actual rows=1 loops=1) + Workers Planned: 3 + Workers Launched: 3 + -> Parallel Seq Scan on local_var_tst (cost=0.00..20.28 rows=4 width=4) (actual rows=0 loops=4) + Filter: (id = 1) +~~END~~ + + +set babelfish_statistics profile OFF +GO + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +drop table local_var_tst +GO diff --git a/test/JDBC/expected/parallel_query/with_recompile-vu-verify.out b/test/JDBC/expected/parallel_query/with_recompile-vu-verify.out index a858e9c8e4..a6d7e55d26 100644 --- a/test/JDBC/expected/parallel_query/with_recompile-vu-verify.out +++ b/test/JDBC/expected/parallel_query/with_recompile-vu-verify.out @@ -115,7 +115,7 @@ Query Text: EXEC p_recomp_11 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 156.798 ms +Babelfish T-SQL Batch Parsing Time: 197.649 ms ~~END~~ set babelfish_showplan_all off @@ -205,7 +205,7 @@ Query Text: EXEC p_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.187 ms +Babelfish T-SQL Batch Parsing Time: 0.261 ms ~~END~~ set babelfish_showplan_all off @@ -256,7 +256,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 3.990 ms +Babelfish T-SQL Batch Parsing Time: 7.061 ms ~~END~~ exec p_recomp_12 0 with recompile @@ -282,7 +282,7 @@ Query Text: EXEC p_recomp_12 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.096 ms +Babelfish T-SQL Batch Parsing Time: 0.173 ms ~~END~~ set babelfish_showplan_all off @@ -314,7 +314,7 @@ Query Text: EXEC p_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 2.406 ms +Babelfish T-SQL Batch Parsing Time: 4.194 ms ~~END~~ set babelfish_showplan_all off @@ -349,7 +349,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.875 ms +Babelfish T-SQL Batch Parsing Time: 1.439 ms ~~END~~ -- test case without execute keyword @@ -376,7 +376,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.102 ms +Babelfish T-SQL Batch Parsing Time: 0.165 ms ~~END~~ set babelfish_showplan_all off @@ -411,7 +411,7 @@ Query Text: EXEC p_recomp_13 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.226 ms +Babelfish T-SQL Batch Parsing Time: 0.395 ms ~~END~~ exec p_recomp_13 0 with recompile @@ -439,7 +439,7 @@ Query Text: EXEC p_recomp_13 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.085 ms +Babelfish T-SQL Batch Parsing Time: 0.145 ms ~~END~~ set babelfish_showplan_all off @@ -545,7 +545,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.114 ms +Babelfish T-SQL Batch Parsing Time: 0.133 ms ~~END~~ exec p_recomp_12 0 with recompile @@ -569,7 +569,7 @@ Query Text: EXEC p_recomp_12 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.113 ms +Babelfish T-SQL Batch Parsing Time: 0.174 ms ~~END~~ set babelfish_showplan_all off @@ -600,7 +600,7 @@ Query Text: EXEC p_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.068 ms +Babelfish T-SQL Batch Parsing Time: 0.117 ms ~~END~~ set babelfish_showplan_all off @@ -633,7 +633,7 @@ Query Text: EXEC p_recomp_13 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.074 ms +Babelfish T-SQL Batch Parsing Time: 0.126 ms ~~END~~ set babelfish_showplan_all off @@ -668,7 +668,7 @@ Query Text: EXEC p_recomp_13 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.063 ms +Babelfish T-SQL Batch Parsing Time: 0.109 ms ~~END~~ exec p_recomp_13 0 with recompile @@ -694,7 +694,7 @@ Query Text: EXEC p_recomp_13 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.080 ms +Babelfish T-SQL Batch Parsing Time: 0.127 ms ~~END~~ set babelfish_showplan_all off @@ -753,7 +753,7 @@ Query Text: EXEC p_recomp_21 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.291 ms +Babelfish T-SQL Batch Parsing Time: 0.470 ms ~~END~~ set babelfish_showplan_all off @@ -803,7 +803,7 @@ Query Text: EXEC p_recomp_21 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.105 ms +Babelfish T-SQL Batch Parsing Time: 0.179 ms ~~END~~ @@ -834,7 +834,7 @@ Query Text: EXEC p_recomp_22 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.243 ms +Babelfish T-SQL Batch Parsing Time: 0.469 ms ~~END~~ set babelfish_showplan_all off @@ -869,7 +869,7 @@ Query Text: EXEC p_recomp_22 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.067 ms +Babelfish T-SQL Batch Parsing Time: 0.124 ms ~~END~~ set babelfish_showplan_all off @@ -917,7 +917,7 @@ Query Text: EXEC p_recomp_21 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.083 ms +Babelfish T-SQL Batch Parsing Time: 0.183 ms ~~END~~ @@ -946,7 +946,7 @@ Query Text: EXEC p_recomp_22 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.080 ms +Babelfish T-SQL Batch Parsing Time: 0.139 ms ~~END~~ set babelfish_showplan_all off @@ -981,7 +981,7 @@ Query Text: EXEC p_recomp_22 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.063 ms +Babelfish T-SQL Batch Parsing Time: 0.100 ms ~~END~~ set babelfish_showplan_all off @@ -1038,7 +1038,7 @@ Query Text: EXEC p_recomp_31 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.304 ms +Babelfish T-SQL Batch Parsing Time: 0.318 ms ~~END~~ set babelfish_showplan_all off @@ -1089,7 +1089,7 @@ Query Text: EXEC p_recomp_31 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.099 ms +Babelfish T-SQL Batch Parsing Time: 0.123 ms ~~END~~ @@ -1120,7 +1120,7 @@ Query Text: EXEC p_recomp_32 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.232 ms +Babelfish T-SQL Batch Parsing Time: 0.404 ms ~~END~~ set babelfish_showplan_all off @@ -1155,7 +1155,7 @@ Query Text: EXEC p_recomp_32 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.071 ms +Babelfish T-SQL Batch Parsing Time: 0.116 ms ~~END~~ set babelfish_showplan_all off @@ -1190,7 +1190,7 @@ Query Text: EXEC p_recomp_33 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.219 ms +Babelfish T-SQL Batch Parsing Time: 0.370 ms ~~END~~ --- tb_recomp_33: with RECOMPILE: bitmap scans ---- @@ -1220,7 +1220,7 @@ Query Text: EXEC p_recomp_33 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.078 ms +Babelfish T-SQL Batch Parsing Time: 0.126 ms ~~END~~ set babelfish_showplan_all off @@ -1268,7 +1268,7 @@ Query Text: EXEC p_recomp_31 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.084 ms +Babelfish T-SQL Batch Parsing Time: 0.124 ms ~~END~~ --- p_recomp_32: EXEC with RECOMPILE: recompiled plan: index scan for paramtrized, bitmap scan for non-parametrized ---- @@ -1296,7 +1296,7 @@ Query Text: EXEC p_recomp_32 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.077 ms +Babelfish T-SQL Batch Parsing Time: 0.106 ms ~~END~~ set babelfish_showplan_all off @@ -1329,7 +1329,7 @@ Query Text: EXEC p_recomp_32 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.064 ms +Babelfish T-SQL Batch Parsing Time: 0.070 ms ~~END~~ set babelfish_showplan_all off @@ -1362,7 +1362,7 @@ Query Text: EXEC p_recomp_33 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.072 ms +Babelfish T-SQL Batch Parsing Time: 0.079 ms ~~END~~ set babelfish_showplan_all off @@ -1395,7 +1395,7 @@ Query Text: EXEC p_recomp_33 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.070 ms +Babelfish T-SQL Batch Parsing Time: 0.068 ms ~~END~~ --- tb_recomp_33 with RECOMPILE: index scan for paramtrized stmt, bitmap scan for non-param stmt ---- @@ -1423,7 +1423,7 @@ Query Text: EXEC p_recomp_33 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.076 ms +Babelfish T-SQL Batch Parsing Time: 0.150 ms ~~END~~ set babelfish_showplan_all off @@ -1608,7 +1608,7 @@ Query Text: EXEC p_recomp_61 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.213 ms +Babelfish T-SQL Batch Parsing Time: 0.161 ms ~~END~~ set babelfish_showplan_all off @@ -1675,7 +1675,7 @@ Query Text: EXEC p_recomp_61 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.117 ms +Babelfish T-SQL Batch Parsing Time: 0.142 ms ~~END~~ set babelfish_showplan_all off @@ -1724,7 +1724,7 @@ Query Text: EXEC p_recomp_61 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.206 ms +Babelfish T-SQL Batch Parsing Time: 0.319 ms ~~END~~ set babelfish_showplan_all off @@ -1787,7 +1787,7 @@ Query Text: EXEC p_recomp_61 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.110 ms +Babelfish T-SQL Batch Parsing Time: 0.149 ms ~~END~~ set babelfish_showplan_all off @@ -1832,7 +1832,7 @@ Query Text: EXEC p_recomp_61 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.116 ms +Babelfish T-SQL Batch Parsing Time: 0.142 ms ~~END~~ set babelfish_showplan_all off @@ -2317,7 +2317,7 @@ Query Text: EXEC p_recomp_51 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.118 ms +Babelfish T-SQL Batch Parsing Time: 0.113 ms ~~END~~ set babelfish_showplan_all off @@ -2453,7 +2453,7 @@ Query Text: EXEC p_recomp_51 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.111 ms +Babelfish T-SQL Batch Parsing Time: 0.110 ms ~~END~~ set babelfish_showplan_all off @@ -2574,7 +2574,7 @@ Query Text: EXEC p_recomp_51 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.104 ms +Babelfish T-SQL Batch Parsing Time: 0.157 ms ~~END~~ set babelfish_showplan_all off @@ -2701,7 +2701,7 @@ Query Text: EXEC p_recomp_51 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.090 ms +Babelfish T-SQL Batch Parsing Time: 0.111 ms ~~END~~ set babelfish_showplan_all off @@ -2811,7 +2811,7 @@ Query Text: EXEC p_recomp_51 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.095 ms +Babelfish T-SQL Batch Parsing Time: 0.152 ms ~~END~~ set babelfish_showplan_all off diff --git a/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-verify.out index f8b8073613..bb4e129853 100644 --- a/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/replicate-before-15_8-or-16_4-vu-verify.out @@ -601,6 +601,8 @@ abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ @@ -609,6 +611,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ @@ -617,6 +621,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ @@ -625,6 +631,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ diff --git a/test/JDBC/expected/replicate-vu-verify.out b/test/JDBC/expected/replicate-vu-verify.out index f454fa22a1..a38a5b2f1b 100644 --- a/test/JDBC/expected/replicate-vu-verify.out +++ b/test/JDBC/expected/replicate-vu-verify.out @@ -601,6 +601,8 @@ abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂🙂abc🙂defghi🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of replicate function.)~~ @@ -609,6 +611,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of replicate function.)~~ @@ -617,6 +621,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of replicate function.)~~ @@ -625,6 +631,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT replicate(@inputString, 4) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of replicate function.)~~ diff --git a/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-verify.out index e9ab22a861..cba16a2330 100644 --- a/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/reverse-before-15_8-or-16_4-vu-verify.out @@ -545,6 +545,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ @@ -553,6 +555,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ @@ -561,6 +565,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ @@ -569,6 +575,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ diff --git a/test/JDBC/expected/reverse-vu-verify.out b/test/JDBC/expected/reverse-vu-verify.out index 3687359bdb..d5ed62036e 100644 --- a/test/JDBC/expected/reverse-vu-verify.out +++ b/test/JDBC/expected/reverse-vu-verify.out @@ -545,6 +545,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of reverse function.)~~ @@ -553,6 +555,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of reverse function.)~~ @@ -561,6 +565,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of reverse function.)~~ @@ -569,6 +575,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT reverse(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of reverse function.)~~ diff --git a/test/JDBC/expected/right-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/right-before-15_8-or-16_4-vu-verify.out index 47d6111894..1f86fb7009 100644 --- a/test/JDBC/expected/right-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/right-before-15_8-or-16_4-vu-verify.out @@ -659,6 +659,8 @@ ghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ @@ -667,6 +669,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ @@ -675,6 +679,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ @@ -683,6 +689,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ diff --git a/test/JDBC/expected/right-vu-verify.out b/test/JDBC/expected/right-vu-verify.out index 8f10999211..3a868d57c2 100644 --- a/test/JDBC/expected/right-vu-verify.out +++ b/test/JDBC/expected/right-vu-verify.out @@ -659,6 +659,8 @@ ghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of right function.)~~ @@ -667,6 +669,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of right function.)~~ @@ -675,6 +679,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of right function.)~~ @@ -683,6 +689,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RIGHT(@inputString, 3) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of right function.)~~ diff --git a/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-verify.out index 7c34054485..a762e62843 100644 --- a/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/rtrim-before-15_8-or-16_4-vu-verify.out @@ -553,6 +553,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ diff --git a/test/JDBC/expected/rtrim-vu-verify.out b/test/JDBC/expected/rtrim-vu-verify.out index 0a1d5f8203..5eab13350c 100644 --- a/test/JDBC/expected/rtrim-vu-verify.out +++ b/test/JDBC/expected/rtrim-vu-verify.out @@ -553,6 +553,8 @@ nvarchar DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of rtrim function.)~~ @@ -561,6 +563,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of rtrim function.)~~ @@ -569,6 +573,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of rtrim function.)~~ @@ -577,6 +583,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT RTRIM(@inputString) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of rtrim function.)~~ diff --git a/test/JDBC/expected/single_db/TestSpatialPoint-vu-verify.out b/test/JDBC/expected/single_db/TestSpatialPoint-vu-verify.out index 352d3f6fb3..e82d355fd2 100644 --- a/test/JDBC/expected/single_db/TestSpatialPoint-vu-verify.out +++ b/test/JDBC/expected/single_db/TestSpatialPoint-vu-verify.out @@ -223,6 +223,8 @@ SET @point1 = geometry::Point(22.34900, -47.65100, 4326);; SET @point2 = 'Test_String'; SELECT @point1.STDistance(@point2); Go +~~START~~ +float ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: parse error - invalid geometry)~~ @@ -2314,6 +2316,8 @@ SET @point1 = geography::Point(22.34900, -47.65100, 4326); SET @point2 = 'Test_String'; SELECT @point2.STDistance(@point1); Go +~~START~~ +float ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: parse error - invalid geometry)~~ diff --git a/test/JDBC/expected/substring-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-verify.out index acae233ba0..9a859de1a5 100644 --- a/test/JDBC/expected/substring-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/substring-before-15_8-or-16_4-vu-verify.out @@ -251,6 +251,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -278,6 +280,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -305,6 +309,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -333,6 +339,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -360,6 +368,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -387,6 +397,8 @@ varchar ~~END~~ +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -517,6 +529,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -544,6 +558,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -582,6 +598,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -609,6 +627,8 @@ nvarchar ~~END~~ +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -637,6 +657,8 @@ varbinary ~~END~~ +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -665,6 +687,8 @@ varbinary ~~END~~ +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -798,6 +822,8 @@ de DECLARE @inputString date = '2016-12-21'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ @@ -807,6 +833,8 @@ DECLARE @date date = '12-21-16'; DECLARE @inputString datetime = @date; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ @@ -815,6 +843,8 @@ GO DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ @@ -823,6 +853,8 @@ GO DECLARE @inputString time(4) = '12:10:05.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ @@ -831,6 +863,8 @@ GO DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ @@ -839,6 +873,8 @@ GO DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ @@ -847,6 +883,8 @@ GO DECLARE @inputString decimal = 123456; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ @@ -855,6 +893,8 @@ GO DECLARE @inputString numeric = 12345.12; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ @@ -863,6 +903,8 @@ GO DECLARE @inputString float = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ @@ -871,6 +913,8 @@ GO DECLARE @inputString real = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ @@ -879,6 +923,8 @@ GO DECLARE @inputString bigint = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ @@ -887,6 +933,8 @@ GO DECLARE @inputString int = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ @@ -895,6 +943,8 @@ GO DECLARE @inputString smallint = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ @@ -903,6 +953,8 @@ GO DECLARE @inputString tinyint = 235; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ @@ -911,6 +963,8 @@ GO DECLARE @inputString money = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ @@ -919,6 +973,8 @@ GO DECLARE @inputString smallmoney = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ @@ -927,6 +983,8 @@ GO DECLARE @inputString bit = 1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ @@ -935,6 +993,8 @@ GO DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ @@ -1056,6 +1116,8 @@ bc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ @@ -1064,6 +1126,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ @@ -1072,6 +1136,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ @@ -1080,6 +1146,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ diff --git a/test/JDBC/expected/substring-vu-verify.out b/test/JDBC/expected/substring-vu-verify.out index 7eac10f0fc..a56f4777b7 100644 --- a/test/JDBC/expected/substring-vu-verify.out +++ b/test/JDBC/expected/substring-vu-verify.out @@ -256,6 +256,8 @@ varchar DECLARE @inputString CHAR(25) = 'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -296,6 +298,8 @@ varchar DECLARE @inputString CHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -336,6 +340,8 @@ varchar DECLARE @inputString CHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -377,6 +383,8 @@ varchar DECLARE @inputString VARCHAR(25) = 'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -417,6 +425,8 @@ varchar DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -457,6 +467,8 @@ varchar DECLARE @inputString VARCHAR(25) = '比尔·拉莫斯' SELECT substring(@inputString, 2, -1) COLLATE CHINESE_PRC_CI_AS GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -600,6 +612,8 @@ nvarchar DECLARE @inputString NCHAR(25) = N'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -640,6 +654,8 @@ nvarchar DECLARE @inputString NCHAR(25) = N'比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -691,6 +707,8 @@ nvarchar DECLARE @inputString NVARCHAR(25) = N'abc🙂defghi🙂🙂' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -731,6 +749,8 @@ nvarchar DECLARE @inputString NVARCHAR(25) = N'比尔·拉莫斯' SELECT substring(@inputString, 2, -1) GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -772,6 +792,8 @@ varbinary DECLARE @inputString BINARY(10) = 0x6162636465666768 SELECT substring(@inputString, 2, -1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -813,6 +835,8 @@ varbinary DECLARE @inputString VARBINARY(10) = 0x6162636465666768 SELECT substring(@inputString, 2, -1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: negative substring length not allowed)~~ @@ -954,6 +978,8 @@ de DECLARE @inputString date = '2016-12-21'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type date is invalid for argument 1 of substring function.)~~ @@ -963,6 +989,8 @@ DECLARE @date date = '12-21-16'; DECLARE @inputString datetime = @date; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime is invalid for argument 1 of substring function.)~~ @@ -971,6 +999,8 @@ GO DECLARE @inputString smalldatetime = '1955-12-13 12:43:10'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smalldatetime is invalid for argument 1 of substring function.)~~ @@ -979,6 +1009,8 @@ GO DECLARE @inputString time(4) = '12:10:05.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type time is invalid for argument 1 of substring function.)~~ @@ -987,6 +1019,8 @@ GO DECLARE @inputString datetimeoffset(4) = '1968-10-23 12:45:37.1234 +10:0'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetimeoffset is invalid for argument 1 of substring function.)~~ @@ -995,6 +1029,8 @@ GO DECLARE @inputString datetime2(4) = '1968-10-23 12:45:37.1237'; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type datetime2 is invalid for argument 1 of substring function.)~~ @@ -1003,6 +1039,8 @@ GO DECLARE @inputString decimal = 123456; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type decimal is invalid for argument 1 of substring function.)~~ @@ -1011,6 +1049,8 @@ GO DECLARE @inputString numeric = 12345.12; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type numeric is invalid for argument 1 of substring function.)~~ @@ -1019,6 +1059,8 @@ GO DECLARE @inputString float = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type float is invalid for argument 1 of substring function.)~~ @@ -1027,6 +1069,8 @@ GO DECLARE @inputString real = 12345.1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type real is invalid for argument 1 of substring function.)~~ @@ -1035,6 +1079,8 @@ GO DECLARE @inputString bigint = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bigint is invalid for argument 1 of substring function.)~~ @@ -1043,6 +1089,8 @@ GO DECLARE @inputString int = 12345678; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type int is invalid for argument 1 of substring function.)~~ @@ -1051,6 +1099,8 @@ GO DECLARE @inputString smallint = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallint is invalid for argument 1 of substring function.)~~ @@ -1059,6 +1109,8 @@ GO DECLARE @inputString tinyint = 235; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type tinyint is invalid for argument 1 of substring function.)~~ @@ -1067,6 +1119,8 @@ GO DECLARE @inputString money = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type money is invalid for argument 1 of substring function.)~~ @@ -1075,6 +1129,8 @@ GO DECLARE @inputString smallmoney = 12356; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type smallmoney is invalid for argument 1 of substring function.)~~ @@ -1083,6 +1139,8 @@ GO DECLARE @inputString bit = 1; SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type bit is invalid for argument 1 of substring function.)~~ @@ -1091,6 +1149,8 @@ GO DECLARE @inputString uniqueidentifier = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS uniqueidentifier) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type uniqueidentifier is invalid for argument 1 of substring function.)~~ @@ -1212,6 +1272,8 @@ bc🙂defghi🙂🙂 DECLARE @inputString sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_variant) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of substring function.)~~ @@ -1220,6 +1282,8 @@ GO DECLARE @inputString xml = CAST ('' AS xml) SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of substring function.)~~ @@ -1228,6 +1292,8 @@ GO DECLARE @inputString geometry = geometry::STGeomFromText('POINT (1 2)', 0); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of substring function.)~~ @@ -1236,6 +1302,8 @@ GO DECLARE @inputString geography = geography::STGeomFromText('POINT(-122.34900 47.65100)', 4326); SELECT substring(@inputString, 4, 1) GO +~~START~~ +varbinary ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geography is invalid for argument 1 of substring function.)~~ diff --git a/test/JDBC/expected/test_dynamic_local_vars.out b/test/JDBC/expected/test_dynamic_local_vars.out new file mode 100644 index 0000000000..de01fca282 --- /dev/null +++ b/test/JDBC/expected/test_dynamic_local_vars.out @@ -0,0 +1,1555 @@ +-- simple vars +declare @i int +declare @j int +set @i = 10 +set @j = @i + 10 +select @i, @j +GO +~~START~~ +int#!#int +10#!#20 +~~END~~ + + +declare @i int +declare @j int +select @i = 10, @j = @i + 10 +select @i, @j +GO +~~START~~ +int#!#int +10#!#20 +~~END~~ + + +declare @i int +declare @j int = 0; +select @i = 10, @j = @i + @j * 2 +select @i, @j +GO +~~START~~ +int#!#int +10#!#10 +~~END~~ + + +declare @i int +declare @j int +select @i = 10, @j = @i + 10 +select @j += 10 +select @i, @j +GO +~~START~~ +int#!#int +10#!#30 +~~END~~ + + +-- should throw an error +declare @i int +select @i = 0, @i += 2 +select @i +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Babelfish does not support assignment to the same variable in SELECT. variable name: "@i")~~ + + +declare @i int +select @i = 10, @i += 10 +select @i +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: Babelfish does not support assignment to the same variable in SELECT. variable name: "@i")~~ + + +-- sub-expr +declare @i int +set @i = 10 +select @i += (5 - 1) +select @i +GO +~~START~~ +int +14 +~~END~~ + + +DECLARE @a int +select @a = (select ~cast('1' as int)) +select @a +go +~~START~~ +int +-2 +~~END~~ + + + +DECLARE @Counter INT = 1; +DECLARE @MaxValue INT = 10; +WHILE @Counter <= @MaxValue +BEGIN + DECLARE @IsEven BIT; + + IF @Counter % 2 = 0 + SET @IsEven = 1; + ELSE + SET @IsEven = 0; + + IF @IsEven = 1 + SELECT CAST(@Counter AS VARCHAR(2)) + ' is even'; + ELSE + SELECT CAST(@Counter AS VARCHAR(2)) + ' is odd'; + + SET @Counter = @Counter + 1; +END; +GO +~~START~~ +varchar +1 is odd +~~END~~ + +~~START~~ +varchar +2 is even +~~END~~ + +~~START~~ +varchar +3 is odd +~~END~~ + +~~START~~ +varchar +4 is even +~~END~~ + +~~START~~ +varchar +5 is odd +~~END~~ + +~~START~~ +varchar +6 is even +~~END~~ + +~~START~~ +varchar +7 is odd +~~END~~ + +~~START~~ +varchar +8 is even +~~END~~ + +~~START~~ +varchar +9 is odd +~~END~~ + +~~START~~ +varchar +10 is even +~~END~~ + + +declare @a numeric (10, 4); +declare @b numeric (10, 4); +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO +~~START~~ +numeric#!#numeric +100.4100#!#200.8200 +~~END~~ + +~~START~~ +numeric +301.2300 +~~END~~ + + +declare @a numeric; +declare @b numeric (10, 4); +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO +~~START~~ +numeric#!#numeric +100#!#200.8200 +~~END~~ + +~~START~~ +numeric +300.8200 +~~END~~ + + +declare @a varbinary +set @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +74 +~~END~~ + + +declare @a varbinary(max) +set @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +746573745F62696E +~~END~~ + + +declare @a varbinary(10) +set @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +746573745F62696E +~~END~~ + + +declare @a varbinary +declare @b varbinary +select @a = cast('test_bin' as varbinary), @b = @a +select @a, @b +GO +~~START~~ +varbinary#!#varbinary +74#!#74 +~~END~~ + + +declare @a varbinary(max) +select @a = cast('test_bin' as varbinary) +select @a +GO +~~START~~ +varbinary +746573745F62696E +~~END~~ + + +DECLARE @a varchar +set @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +1#!#1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @v varchar(20); +SELECT @v = NULL; +SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) +GO +~~START~~ +int#!#int#!#int +0#!##!# +~~END~~ + + +DECLARE @a varchar(max) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +-- collate can not be used with local variables +DECLARE @v varchar(20) collate BBF_Unicode_CP1_CI_As = 'ci_as'; +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near 'collate' at line 2 and character position 23)~~ + + +declare @source int; +declare @target sql_variant; +select @source = 1.0 +select @target = cast(@source as varchar(10)); +SELECT sql_variant_property(@target, 'basetype'); +select @target +GO +~~START~~ +sql_variant +varchar +~~END~~ + +~~START~~ +sql_variant +1 +~~END~~ + + +declare @source int; +declare @target varchar(10); +select @source = 1.0 +select cast(@source as varchar(10)) +select @target = cast(@source as varchar(10)); +select @target +GO +~~START~~ +varchar +1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @a pg_catalog.varchar +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DECLARE @a pg_catalog.varchar(100) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DECLARE @a pg_catalog.varchar(10) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +10#!#10 +~~END~~ + +~~START~~ +varchar +1234567890 +~~END~~ + + +DECLARE @a varchar +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +1#!#1 +~~END~~ + +~~START~~ +varchar +1 +~~END~~ + + +DECLARE @a varchar(100) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DECLARE @a varchar(10) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +10#!#10 +~~END~~ + +~~START~~ +varchar +1234567890 +~~END~~ + + +DECLARE @a int +set @a = 0 +select @a ^= 1 +select @a +go +~~START~~ +int +1 +~~END~~ + + +DECLARE @a int +set @a = 0 +select @a += ~@a +select @a +go +~~START~~ +int +-1 +~~END~~ + + +SET QUOTED_IDENTIFIER OFF +GO + +-- quoted identifiers +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += "a""b''c'd", @v2 += "x""y''z"; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCa"b''c'd#!#XYZx"y''z +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += "a""b''c'd", @v2 += @v + "x""y''z"; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCa"b''c'd#!#XYZABCa"b''c'dx"y''z +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += @v + "x""y''z"; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCd'c''b"a#!#XYZABCd'c''b"ax"y''z +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += @v + reverse("x""y''z"); +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCd'c''b"a#!#XYZABCd'c''b"az''y"x +~~END~~ + + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += REVERSE( @v + reverse("x""y''z")); +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCd'c''b"a#!#XYZx"y''za"b''c'dCBA +~~END~~ + + +SET QUOTED_IDENTIFIER ON +GO + +declare @v varchar(20) = 'ABC', @v2 varchar(20)='XYZ'; +select @v += 'abc', @v2 += 'xyz'; +select @v, @v2 +GO +~~START~~ +varchar#!#varchar +ABCabc#!#XYZxyz +~~END~~ + + +declare @a int = 1, @b int = 2; +select @a = 2, @b = @a + 2 +select @a, @b +GO +~~START~~ +int#!#int +2#!#4 +~~END~~ + + +declare @a int = 1, @b int = 2; +select @a += 2, @b -= @a + 2 +select @a, @b +GO +~~START~~ +int#!#int +3#!#-3 +~~END~~ + + +-- xml methods +DECLARE @a bit = 1 +DECLARE @xml XML = ' ' +SELECT @a |= @xml.exist('/artists/artist/@name') +select @a +GO +~~START~~ +bit +1 +~~END~~ + + +DECLARE @a bit = 1 +DECLARE @xml XML; +SELECT @xml = ' ', @a |= @xml.exist('/artists/artist/@name') +select @a +GO +~~START~~ +bit +1 +~~END~~ + + +-- test all kind of udts +create type udt from NCHAR +go + +declare @a udt +select @a = 'anc' +select @a +GO +~~START~~ +nchar +a +~~END~~ + + +DROP type udt +GO + +create type varchar_max from varchar(max) +GO + +DECLARE @a varchar_max +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO +~~START~~ +int#!#int +35#!#35 +~~END~~ + +~~START~~ +varchar +12345678901234567890123456789012345 +~~END~~ + + +DROP type varchar_max +GO + +create type num_def from numeric +GO + +declare @a numeric; +declare @b num_def; +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO +~~START~~ +numeric#!#numeric +100#!#201 +~~END~~ + +~~START~~ +numeric +301 +~~END~~ + + +drop type num_def +GO + +/* + * select/update test + */ +create table local_var_tst (id int) +GO + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (6) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- txn does not affect local variables +begin tran +declare @i int +update local_var_tst set id = 5, @i = id * 5 +select @i +ROLLBACK tran +select @i +GO +~~ROW COUNT: 3~~ + +~~START~~ +int +25 +~~END~~ + +~~START~~ +int +25 +~~END~~ + + +select * from local_var_tst; +GO +~~START~~ +int +1 +2 +6 +~~END~~ + + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +-- should return 4 +declare @i int +select @i = 1 +select @i = id * 2 from local_var_tst where id = @i +select @i +GO +~~START~~ +int +2 +~~END~~ + + +declare @i int +select @i = 1 +select @i = @i + id * 2 from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +declare @i int +select @i = 1 +select @i = id * 2 + @i from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +declare @i int +select @i = 1 +select @i += id * 2 from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +-- 3 parts name +declare @i int +select @i = 1 +select @i += master.dbo.local_var_tst.id * 2 from local_var_tst +select @i +GO +~~START~~ +int +7 +~~END~~ + + +-- local var name same as column +declare @id int = 1 +select @id += master.dbo.local_var_tst.id * 2 from local_var_tst +select @id +GO +~~START~~ +int +7 +~~END~~ + + +-- should throw an error +declare @i int +declare @j int +set @i = 10 +set @j = 0; +select @i += (select @j = @j + id from local_var_tst) +select @i +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: variable assignment can be used only in top-level SELECT)~~ + + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +DECLARE @ans INT +SELECT @ans = AVG(id) FROM local_var_tst +select @ans +GO +~~START~~ +int +1 +~~END~~ + + +-- local variable inside functions +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + SELECT @ans = AVG(id) FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func(); +GO +~~START~~ +int +1 +~~END~~ + + +DROP FUNCTION var_inside_func(); +GO + +-- show throw an error +CREATE FUNCTION var_inside_func() +RETURNS @tab table (a int) as +BEGIN + DECLARE @ans INT + SELECT @ans += id from local_var_tst + select @ans +END +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: SELECT statement returning result to a client cannot be used in a function)~~ + + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + SELECT @ans += id FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func() +go +~~START~~ +int + +~~END~~ + + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func(@def int) +RETURNS INT AS +BEGIN + DECLARE @ans INT; + select @ans = @def; + SELECT @ans += id FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func(0) +go +~~START~~ +int +3 +~~END~~ + + +declare @def int = 1; +select var_inside_func(@def) +go +~~START~~ +int +4 +~~END~~ + + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + select @ans = 0 + SELECT @ans += id + @ans FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func() +go +~~START~~ +int +4 +~~END~~ + + +drop function if exists var_inside_func +go + +-- variable with procedure +CREATE PROCEDURE var_with_procedure (@a numeric(10,4) OUTPUT) AS +BEGIN + SET @a=100.41; + select @a as a; +END; +GO + +exec var_with_procedure 2.000; +GO +~~START~~ +numeric +100.4100 +~~END~~ + + +-- value of @out should remain 2.000 +declare @out numeric(10,4); +set @out = 2.000; +exec var_with_procedure 2.000; +select @out +GO +~~START~~ +numeric +100.4100 +~~END~~ + +~~START~~ +numeric +2.0000 +~~END~~ + + +drop procedure var_with_procedure; +GO + +CREATE PROCEDURE var_with_procedure_1 (@a numeric(10,4) OUTPUT, @b numeric(10,4) OUTPUT) AS +BEGIN + SET @a=100.41; + SET @b=200.82; + select @a+@b as r; +END; +GO + +EXEC var_with_procedure_1 2.000, 3.000; +GO +~~START~~ +numeric +301.2300 +~~END~~ + + +-- value of @a should be 100 +DECLARE @a INT; +EXEC var_with_procedure_1 @a OUT, 3.000; +SELECT @a; +GO +~~START~~ +numeric +301.2300 +~~END~~ + +~~START~~ +int +100 +~~END~~ + + +drop procedure var_with_procedure_1; +GO + +CREATE PROCEDURE var_with_procedure_2 +AS +BEGIN + declare @a int + declare @b int + set @a = 1 + return + select @b=@a+1 +END +GO + +exec var_with_procedure_2 +GO + +DROP PROCEDURE var_with_procedure_2 +GO + +-- insert testing with local variables +truncate table dbo.local_var_tst +go + +-- should throw an error +declare @a int = 1 +insert into local_var_tst select @a = @a + 1 +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: variable assignment can be used only in top-level SELECT)~~ + + +-- syntax error +declare @a int = 1 +insert into local_var_tst values (@a = @a + 1) +GO +~~ERROR (Code: 33557097)~~ + +~~ERROR (Message: syntax error near '=' at line 3 and character position 37)~~ + + +declare @a int = 1 +insert into local_var_tst values (@a + 1) +GO +~~ROW COUNT: 1~~ + + +-- output clause with insert +declare @a int = 1 +declare @mytbl table(a int) +insert local_var_tst output inserted.id into @mytbl values (@a + 1) +select * from @mytbl +GO +~~ROW COUNT: 1~~ + +~~START~~ +int +2 +~~END~~ + + +-- output clause with delete +declare @a int = 1 +declare @mytbl table(a int) +delete local_var_tst output deleted.id into @mytbl where id = @a + 1 +select * from @mytbl +GO +~~ROW COUNT: 2~~ + +~~START~~ +int +2 +2 +~~END~~ + + +drop table dbo.local_var_tst +go + +create table local_var_tst_1 (a int, b int) +GO + +insert into local_var_tst_1 values (1,3), (2, 4) +go +~~ROW COUNT: 2~~ + + + +-- select test with multi-variable assignment +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += b from local_var_tst_1 +select @a, @b +go +~~START~~ +int#!#int +3#!#7 +~~END~~ + + +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += @a + b from local_var_tst_1 +select @a, @b +go +~~START~~ +int#!#int +3#!#11 +~~END~~ + + +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += @a + ~b from local_var_tst_1 +select @a, @b +go +~~START~~ +int#!#int +3#!#-5 +~~END~~ + + +drop table local_var_tst_1 +go + +create table local_var_str_tst (id varchar(100)) +GO + +insert into local_var_str_tst values ('abc'), (' '), ('def') +GO +~~ROW COUNT: 3~~ + + +declare @i varchar(1000) +set @i = '' +select @i = @i + id from local_var_str_tst +select @i +go +~~START~~ +varchar +abc def +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i = id + @i from local_var_str_tst +select @i +go +~~START~~ +varchar +def abc +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i += id from local_var_str_tst +select @i +go +~~START~~ +varchar +abc def +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i = reverse(@i + 'id') from local_var_str_tst +select @i +go +~~START~~ +varchar +didiid +~~END~~ + + +declare @i varchar(1000) +set @i = '' +select @i += reverse(id) from local_var_str_tst +select @i +go +~~START~~ +varchar +cba fed +~~END~~ + + +declare @i varchar(1000) +set @i = 'abc' +select @i = reverse(@i) +select @i +go +~~START~~ +varchar +cba +~~END~~ + + +-- function call like trim, ltrim, etc will be rewritten by ANTLR +declare @i varchar(1000) +set @i = ' ' +select @i += id from local_var_str_tst +select len(@i), @i +select @i = trim(@i) +select len(@i), @i +go +~~START~~ +int#!#varchar +8#!# abc def +~~END~~ + +~~START~~ +int#!#varchar +7#!#abc def +~~END~~ + + +drop table local_var_str_tst; +go + +-- $PARTITION is rewritten by ANTLR +CREATE PARTITION FUNCTION RangePF1 ( INT ) +AS RANGE RIGHT FOR VALUES (10, 100, 1000) ; +GO + +declare @res int = -1; +SELECT @res = $PARTITION.RangePF1 (10); +select @res +select 1 where @res = $PARTITION.RangePF1 (10); +SELECT @res = $PARTITION.RangePF1 (@res); +select @res +GO +~~START~~ +int +2 +~~END~~ + +~~START~~ +int +1 +~~END~~ + +~~START~~ +int +1 +~~END~~ + + +DROP PARTITION FUNCTION RangePF1 +GO + +CREATE SEQUENCE CountBy1 + START WITH 1 + INCREMENT BY 1 ; +GO + +-- NEXT VALUE FOR gets re-written by ANTLR +DECLARE @myvar1 BIGINT = NEXT VALUE FOR CountBy1 ; +DECLARE @myvar2 BIGINT ; +DECLARE @myvar3 BIGINT ; +select @myvar2 = NEXT VALUE FOR CountBy1 ; +SELECT @myvar3 = NEXT VALUE FOR CountBy1 ; +SELECT @myvar1 AS myvar1, @myvar2 AS myvar2, @myvar3 AS myvar3 ; +GO +~~START~~ +bigint#!#bigint#!#bigint +1#!#2#!#3 +~~END~~ + + +DROP SEQUENCE CountBy1 +GO + +-- any @@ is also re-written by ANTLR +declare @pid int = 0 +select @pid += @@spid +select 1 where @pid = @@spid +go +~~START~~ +int +1 +~~END~~ + + +-- float point notation also gets rewritten by ANTLR e.g., 2.1E, -.2e+, -2.e- +declare @a float = 0 +select @a = 2.1E +select @a +select @a = -.2e+ +select @a +select @a = -2.e- +select @a +go +~~START~~ +float +2.1 +~~END~~ + +~~START~~ +float +-0.2 +~~END~~ + +~~START~~ +float +-2.0 +~~END~~ + + +-- variables only in select target list shows dynamic behavior +create table local_var_tst (id int) +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (1) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +declare @i int = 1 +declare @j int = 0 +select @j += id, @i = id + 1 from local_var_tst where id = @i +select @i, @j +go +~~START~~ +int#!#int +2#!#2 +~~END~~ + + +declare @i int = 1 +select @i = id * 2 from local_var_tst where id = @i +select @i +GO +~~START~~ +int +2 +~~END~~ + + + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +set babelfish_statistics profile On; +GO + +declare @i int = 1 +declare @j int = 0 +select @j += id, @i = id + 1 from local_var_tst where id = @i +select @i, @j +go +~~START~~ +text +Query Text: select sys.pltsql_assign_var(3, @j + cast((id) as int)), sys.pltsql_assign_var(2, cast((id + 1) as int)) from local_var_tst where id = "@i" +Seq Scan on local_var_tst (cost=0.00..42.01 rows=13 width=8) (actual rows=2 loops=1) + Filter: (id = 1) + Rows Removed by Filter: 1 +~~END~~ + +~~START~~ +int#!#int +2#!#2 +~~END~~ + +~~START~~ +text +Query Text: select "@i", "@j" +Result (cost=0.00..0.01 rows=1 width=8) (actual rows=1 loops=1) +~~END~~ + + +declare @i int = 1 +select @i = @i * 2 from local_var_tst where id = @i +select @i +GO +~~START~~ +text +Query Text: select sys.pltsql_assign_var(2, cast((@i * 2) as int)) from local_var_tst where id = "@i" +Seq Scan on local_var_tst (cost=0.00..41.94 rows=13 width=4) (actual rows=2 loops=1) + Filter: (id = 1) + Rows Removed by Filter: 1 +~~END~~ + +~~START~~ +int +4 +~~END~~ + +~~START~~ +text +Query Text: select "@i" +Result (cost=0.00..0.01 rows=1 width=4) (actual rows=1 loops=1) +~~END~~ + + +set babelfish_statistics profile OFF +GO + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +-- declared variable name with length > 63 +declare @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr += 1 +select @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +2 +~~END~~ + + +-- variable names starting with @@ +declare @@a int = 1; +select @@a = @@a + 1 +select @@a +GO +~~START~~ +int +2 +~~END~~ + + +declare @@a int = 1; +select @@a += 1 +select @@a +GO +~~START~~ +int +2 +~~END~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr + 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +2 +~~END~~ + + +truncate table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (1) +GO +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + +~~ROW COUNT: 1~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr + id from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +5 +~~END~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = id + @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +5 +~~END~~ + + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr += id from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO +~~START~~ +int +5 +~~END~~ + + +truncate table local_var_tst +GO + +insert into local_var_tst values (1) +GO +~~ROW COUNT: 1~~ + + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +GO +~~START~~ +text +off +~~END~~ + + +set babelfish_statistics profile On; +GO + +-- error while evaluating const expression +declare @a int = 1; +select @a = 1 / 0 from local_var_tst +select * from local_var_tst where id = @a +GO +~~ERROR (Code: 8134)~~ + +~~ERROR (Message: division by zero)~~ + +~~START~~ +int +1 +~~END~~ + +~~START~~ +text +Query Text: select * from local_var_tst where id = "@a" +Seq Scan on local_var_tst (cost=0.00..41.88 rows=13 width=4) (actual rows=1 loops=1) + Filter: (id = 1) +~~END~~ + + +set babelfish_statistics profile OFF +GO + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +GO +~~START~~ +text +on +~~END~~ + + +drop table local_var_tst +GO diff --git a/test/JDBC/expected/translate-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-verify.out index 13b05f6704..3d36bb191e 100644 --- a/test/JDBC/expected/translate-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/translate-before-15_8-or-16_4-vu-verify.out @@ -654,6 +654,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -694,6 +696,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -702,6 +706,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -751,6 +757,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -791,6 +799,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -799,6 +809,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1013,6 +1025,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1021,6 +1035,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1061,6 +1077,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1069,6 +1087,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1118,6 +1138,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1167,6 +1189,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1372,6 +1396,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1380,6 +1406,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1420,6 +1448,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1428,6 +1458,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1477,6 +1509,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1526,6 +1560,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1731,6 +1767,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1739,6 +1777,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1779,6 +1819,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1787,6 +1829,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1836,6 +1880,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1885,6 +1931,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ diff --git a/test/JDBC/expected/translate-vu-verify.out b/test/JDBC/expected/translate-vu-verify.out index 4f0f913424..76034cf8ab 100644 --- a/test/JDBC/expected/translate-vu-verify.out +++ b/test/JDBC/expected/translate-vu-verify.out @@ -654,6 +654,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = 'ab?', @translations VARCHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -694,6 +696,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -702,6 +706,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -751,6 +757,8 @@ varchar DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -791,6 +799,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -799,6 +809,8 @@ GO DECLARE @inputString CHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = N'ab?', @translations CHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1013,6 +1025,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1021,6 +1035,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1061,6 +1077,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1069,6 +1087,8 @@ GO DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1118,6 +1138,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1167,6 +1189,8 @@ varchar DECLARE @inputString VARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1372,6 +1396,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1380,6 +1406,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1420,6 +1448,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1428,6 +1458,8 @@ GO DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1477,6 +1509,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1526,6 +1560,8 @@ nvarchar DECLARE @inputString NCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1731,6 +1767,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1739,6 +1777,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters CHAR(20) = 'ab?', @translations CHAR(40) = 'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1779,6 +1819,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂y' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1787,6 +1829,8 @@ GO DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NCHAR(20) = N'ab?', @translations NCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1836,6 +1880,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters NVARCHAR(20) = N'ab?', @translations NVARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ @@ -1885,6 +1931,8 @@ nvarchar DECLARE @inputString NVARCHAR(50) = ' abc🙂defghi🙂🙂 ', @characters VARCHAR(20) = N'ab?', @translations VARCHAR(40) = N'x🙂yw' SELECT '|' + TRANSLATE(@inputString, @characters, @translations) + '|' GO +~~START~~ +nvarchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: The second and third arguments of the TRANSLATE built-in function must contain an equal number of characters.)~~ diff --git a/test/JDBC/expected/upper_lower-before-15_8-or-16_4-vu-verify.out b/test/JDBC/expected/upper_lower-before-15_8-or-16_4-vu-verify.out index 9b2585b16d..15ab10f69b 100644 --- a/test/JDBC/expected/upper_lower-before-15_8-or-16_4-vu-verify.out +++ b/test/JDBC/expected/upper_lower-before-15_8-or-16_4-vu-verify.out @@ -530,6 +530,8 @@ DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_ SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ @@ -539,6 +541,8 @@ DECLARE @myid xml = CAST ('' AS xml) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ @@ -548,6 +552,8 @@ DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ @@ -815,6 +821,8 @@ adjnfjh declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) select upper(@b) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ diff --git a/test/JDBC/expected/upper_lower-vu-verify.out b/test/JDBC/expected/upper_lower-vu-verify.out index 3c8a50e643..d10fef792e 100644 --- a/test/JDBC/expected/upper_lower-vu-verify.out +++ b/test/JDBC/expected/upper_lower-vu-verify.out @@ -530,6 +530,8 @@ DECLARE @myid sql_variant = CAST ('6F9619FF-8B86-D011-B42D-00C04FC964FF' AS sql_ SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type sql_variant is invalid for argument 1 of upper function.)~~ @@ -539,6 +541,8 @@ DECLARE @myid xml = CAST ('' AS xml) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type xml is invalid for argument 1 of upper function.)~~ @@ -548,6 +552,8 @@ DECLARE @myid geometry = geometry::STGeomFromText('POINT (1 2)', 0) SELECT UPPER(@myid) SELECT LOWER(@myid) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type geometry is invalid for argument 1 of upper function.)~~ @@ -838,6 +844,8 @@ adjnfjh declare @b dbo.MyUDT = CAST('scsdc' AS dbo.MyUDT) select upper(@b) GO +~~START~~ +varchar ~~ERROR (Code: 33557097)~~ ~~ERROR (Message: Argument data type image is invalid for argument 1 of upper function.)~~ diff --git a/test/JDBC/expected/with_recompile-vu-verify.out b/test/JDBC/expected/with_recompile-vu-verify.out index 170f8f6b83..d2bbb373de 100644 --- a/test/JDBC/expected/with_recompile-vu-verify.out +++ b/test/JDBC/expected/with_recompile-vu-verify.out @@ -109,7 +109,7 @@ Query Text: EXEC p_recomp_11 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 156.942 ms +Babelfish T-SQL Batch Parsing Time: 168.130 ms ~~END~~ set babelfish_showplan_all off @@ -193,7 +193,7 @@ Query Text: EXEC p_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.172 ms +Babelfish T-SQL Batch Parsing Time: 0.117 ms ~~END~~ set babelfish_showplan_all off @@ -238,7 +238,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 4.244 ms +Babelfish T-SQL Batch Parsing Time: 3.643 ms ~~END~~ exec p_recomp_12 0 with recompile @@ -258,7 +258,7 @@ Query Text: EXEC p_recomp_12 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.124 ms +Babelfish T-SQL Batch Parsing Time: 0.092 ms ~~END~~ set babelfish_showplan_all off @@ -284,7 +284,7 @@ Query Text: EXEC p_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 3.839 ms +Babelfish T-SQL Batch Parsing Time: 2.300 ms ~~END~~ set babelfish_showplan_all off @@ -313,7 +313,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 1.338 ms +Babelfish T-SQL Batch Parsing Time: 0.856 ms ~~END~~ -- test case without execute keyword @@ -334,7 +334,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.148 ms +Babelfish T-SQL Batch Parsing Time: 0.139 ms ~~END~~ set babelfish_showplan_all off @@ -363,7 +363,7 @@ Query Text: EXEC p_recomp_13 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.321 ms +Babelfish T-SQL Batch Parsing Time: 0.210 ms ~~END~~ exec p_recomp_13 0 with recompile @@ -385,7 +385,7 @@ Query Text: EXEC p_recomp_13 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.119 ms +Babelfish T-SQL Batch Parsing Time: 0.085 ms ~~END~~ set babelfish_showplan_all off @@ -485,7 +485,7 @@ Query Text: EXEC p_recomp_11 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.113 ms +Babelfish T-SQL Batch Parsing Time: 0.073 ms ~~END~~ exec p_recomp_12 0 with recompile @@ -503,7 +503,7 @@ Query Text: EXEC p_recomp_12 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.114 ms +Babelfish T-SQL Batch Parsing Time: 0.082 ms ~~END~~ set babelfish_showplan_all off @@ -528,7 +528,7 @@ Query Text: EXEC p_recomp_12 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.102 ms +Babelfish T-SQL Batch Parsing Time: 0.064 ms ~~END~~ set babelfish_showplan_all off @@ -555,7 +555,7 @@ Query Text: EXEC p_recomp_13 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.110 ms +Babelfish T-SQL Batch Parsing Time: 0.069 ms ~~END~~ set babelfish_showplan_all off @@ -584,7 +584,7 @@ Query Text: EXEC p_recomp_13 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.096 ms +Babelfish T-SQL Batch Parsing Time: 0.062 ms ~~END~~ exec p_recomp_13 0 with recompile @@ -604,7 +604,7 @@ Query Text: EXEC p_recomp_13 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.118 ms +Babelfish T-SQL Batch Parsing Time: 0.078 ms ~~END~~ set babelfish_showplan_all off @@ -657,7 +657,7 @@ Query Text: EXEC p_recomp_21 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.330 ms +Babelfish T-SQL Batch Parsing Time: 0.217 ms ~~END~~ set babelfish_showplan_all off @@ -701,7 +701,7 @@ Query Text: EXEC p_recomp_21 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.117 ms +Babelfish T-SQL Batch Parsing Time: 0.071 ms ~~END~~ @@ -726,7 +726,7 @@ Query Text: EXEC p_recomp_22 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.299 ms +Babelfish T-SQL Batch Parsing Time: 0.196 ms ~~END~~ set babelfish_showplan_all off @@ -755,7 +755,7 @@ Query Text: EXEC p_recomp_22 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.105 ms +Babelfish T-SQL Batch Parsing Time: 0.064 ms ~~END~~ set babelfish_showplan_all off @@ -797,7 +797,7 @@ Query Text: EXEC p_recomp_21 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.114 ms +Babelfish T-SQL Batch Parsing Time: 0.071 ms ~~END~~ @@ -820,7 +820,7 @@ Query Text: EXEC p_recomp_22 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.114 ms +Babelfish T-SQL Batch Parsing Time: 0.075 ms ~~END~~ set babelfish_showplan_all off @@ -849,7 +849,7 @@ Query Text: EXEC p_recomp_22 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.100 ms +Babelfish T-SQL Batch Parsing Time: 0.064 ms ~~END~~ set babelfish_showplan_all off @@ -900,7 +900,7 @@ Query Text: EXEC p_recomp_31 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.324 ms +Babelfish T-SQL Batch Parsing Time: 0.229 ms ~~END~~ set babelfish_showplan_all off @@ -945,7 +945,7 @@ Query Text: EXEC p_recomp_31 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.111 ms +Babelfish T-SQL Batch Parsing Time: 0.070 ms ~~END~~ @@ -970,7 +970,7 @@ Query Text: EXEC p_recomp_32 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.302 ms +Babelfish T-SQL Batch Parsing Time: 0.191 ms ~~END~~ set babelfish_showplan_all off @@ -999,7 +999,7 @@ Query Text: EXEC p_recomp_32 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.102 ms +Babelfish T-SQL Batch Parsing Time: 0.064 ms ~~END~~ set babelfish_showplan_all off @@ -1028,7 +1028,7 @@ Query Text: EXEC p_recomp_33 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.309 ms +Babelfish T-SQL Batch Parsing Time: 0.190 ms ~~END~~ --- tb_recomp_33: with RECOMPILE: bitmap scans ---- @@ -1052,7 +1052,7 @@ Query Text: EXEC p_recomp_33 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.102 ms +Babelfish T-SQL Batch Parsing Time: 0.077 ms ~~END~~ set babelfish_showplan_all off @@ -1094,7 +1094,7 @@ Query Text: EXEC p_recomp_31 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.090 ms +Babelfish T-SQL Batch Parsing Time: 0.071 ms ~~END~~ --- p_recomp_32: EXEC with RECOMPILE: recompiled plan: index scan for paramtrized, bitmap scan for non-parametrized ---- @@ -1116,7 +1116,7 @@ Query Text: EXEC p_recomp_32 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.078 ms +Babelfish T-SQL Batch Parsing Time: 0.103 ms ~~END~~ set babelfish_showplan_all off @@ -1143,7 +1143,7 @@ Query Text: EXEC p_recomp_32 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.064 ms +Babelfish T-SQL Batch Parsing Time: 0.063 ms ~~END~~ set babelfish_showplan_all off @@ -1170,7 +1170,7 @@ Query Text: EXEC p_recomp_33 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.116 ms +Babelfish T-SQL Batch Parsing Time: 0.070 ms ~~END~~ set babelfish_showplan_all off @@ -1197,7 +1197,7 @@ Query Text: EXEC p_recomp_33 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.100 ms +Babelfish T-SQL Batch Parsing Time: 0.062 ms ~~END~~ --- tb_recomp_33 with RECOMPILE: index scan for paramtrized stmt, bitmap scan for non-param stmt ---- @@ -1219,7 +1219,7 @@ Query Text: EXEC p_recomp_33 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.114 ms +Babelfish T-SQL Batch Parsing Time: 0.073 ms ~~END~~ set babelfish_showplan_all off @@ -1392,7 +1392,7 @@ Query Text: EXEC p_recomp_61 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.094 ms +Babelfish T-SQL Batch Parsing Time: 0.161 ms ~~END~~ set babelfish_showplan_all off @@ -1447,7 +1447,7 @@ Query Text: EXEC p_recomp_61 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.093 ms +Babelfish T-SQL Batch Parsing Time: 0.158 ms ~~END~~ set babelfish_showplan_all off @@ -1484,7 +1484,7 @@ Query Text: EXEC p_recomp_61 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.150 ms +Babelfish T-SQL Batch Parsing Time: 0.231 ms ~~END~~ set babelfish_showplan_all off @@ -1535,7 +1535,7 @@ Query Text: EXEC p_recomp_61 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.093 ms +Babelfish T-SQL Batch Parsing Time: 0.094 ms ~~END~~ set babelfish_showplan_all off @@ -1568,7 +1568,7 @@ Query Text: EXEC p_recomp_61 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.110 ms +Babelfish T-SQL Batch Parsing Time: 0.108 ms ~~END~~ set babelfish_showplan_all off @@ -2011,7 +2011,7 @@ Query Text: EXEC p_recomp_51 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.065 ms +Babelfish T-SQL Batch Parsing Time: 0.074 ms ~~END~~ set babelfish_showplan_all off @@ -2105,7 +2105,7 @@ Query Text: EXEC p_recomp_51 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.105 ms +Babelfish T-SQL Batch Parsing Time: 0.067 ms ~~END~~ set babelfish_showplan_all off @@ -2184,7 +2184,7 @@ Query Text: EXEC p_recomp_51 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.109 ms +Babelfish T-SQL Batch Parsing Time: 0.075 ms ~~END~~ set babelfish_showplan_all off @@ -2269,7 +2269,7 @@ Query Text: EXEC p_recomp_51 0 ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.097 ms +Babelfish T-SQL Batch Parsing Time: 0.066 ms ~~END~~ set babelfish_showplan_all off @@ -2337,7 +2337,7 @@ Query Text: EXEC p_recomp_51 0 /* EXECUTE WITH RECOMPILE */ ~~START~~ text -Babelfish T-SQL Batch Parsing Time: 0.111 ms +Babelfish T-SQL Batch Parsing Time: 0.077 ms ~~END~~ set babelfish_showplan_all off diff --git a/test/JDBC/input/test_dynamic_local_vars.sql b/test/JDBC/input/test_dynamic_local_vars.sql new file mode 100644 index 0000000000..be95f21e41 --- /dev/null +++ b/test/JDBC/input/test_dynamic_local_vars.sql @@ -0,0 +1,821 @@ +-- parallel_query_expected +-- simple vars +declare @i int +declare @j int +set @i = 10 +set @j = @i + 10 +select @i, @j +GO + +declare @i int +declare @j int +select @i = 10, @j = @i + 10 +select @i, @j +GO + +declare @i int +declare @j int = 0; +select @i = 10, @j = @i + @j * 2 +select @i, @j +GO + +declare @i int +declare @j int +select @i = 10, @j = @i + 10 +select @j += 10 +select @i, @j +GO + +-- should throw an error +declare @i int +select @i = 0, @i += 2 +select @i +GO + +declare @i int +select @i = 10, @i += 10 +select @i +GO + +-- sub-expr +declare @i int +set @i = 10 +select @i += (5 - 1) +select @i +GO + +DECLARE @a int +select @a = (select ~cast('1' as int)) +select @a +go + +DECLARE @Counter INT = 1; +DECLARE @MaxValue INT = 10; + +WHILE @Counter <= @MaxValue +BEGIN + DECLARE @IsEven BIT; + + IF @Counter % 2 = 0 + SET @IsEven = 1; + ELSE + SET @IsEven = 0; + + IF @IsEven = 1 + SELECT CAST(@Counter AS VARCHAR(2)) + ' is even'; + ELSE + SELECT CAST(@Counter AS VARCHAR(2)) + ' is odd'; + + SET @Counter = @Counter + 1; +END; +GO + +declare @a numeric (10, 4); +declare @b numeric (10, 4); +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO + +declare @a numeric; +declare @b numeric (10, 4); +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO + +declare @a varbinary +set @a = cast('test_bin' as varbinary) +select @a +GO + +declare @a varbinary(max) +set @a = cast('test_bin' as varbinary) +select @a +GO + +declare @a varbinary(10) +set @a = cast('test_bin' as varbinary) +select @a +GO + +declare @a varbinary +declare @b varbinary +select @a = cast('test_bin' as varbinary), @b = @a +select @a, @b +GO + +declare @a varbinary(max) +select @a = cast('test_bin' as varbinary) +select @a +GO + +DECLARE @a varchar +set @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DECLARE @v varchar(20); +SELECT @v = NULL; +SELECT ISNUMERIC(@v), LEN(@v), DATALENGTH(@v) +GO + +DECLARE @a varchar(max) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +-- collate can not be used with local variables +DECLARE @v varchar(20) collate BBF_Unicode_CP1_CI_As = 'ci_as'; +GO + +declare @source int; +declare @target sql_variant; +select @source = 1.0 +select @target = cast(@source as varchar(10)); +SELECT sql_variant_property(@target, 'basetype'); +select @target +GO + +declare @source int; +declare @target varchar(10); +select @source = 1.0 +select cast(@source as varchar(10)) +select @target = cast(@source as varchar(10)); +select @target +GO + +DECLARE @a pg_catalog.varchar +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DECLARE @a pg_catalog.varchar(100) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DECLARE @a pg_catalog.varchar(10) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DECLARE @a varchar +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DECLARE @a varchar(100) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DECLARE @a varchar(10) +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DECLARE @a int +set @a = 0 +select @a ^= 1 +select @a +go + +DECLARE @a int +set @a = 0 +select @a += ~@a +select @a +go + +SET QUOTED_IDENTIFIER OFF +GO + +-- quoted identifiers +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += "a""b''c'd", @v2 += "x""y''z"; +select @v, @v2 +GO + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += "a""b''c'd", @v2 += @v + "x""y''z"; +select @v, @v2 +GO + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += @v + "x""y''z"; +select @v, @v2 +GO + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += @v + reverse("x""y''z"); +select @v, @v2 +GO + +declare @v varchar(20) = "ABC", @v2 varchar(20)="XYZ"; +select @v += reverse("a""b''c'd"), @v2 += REVERSE( @v + reverse("x""y''z")); +select @v, @v2 +GO + +SET QUOTED_IDENTIFIER ON +GO + +declare @v varchar(20) = 'ABC', @v2 varchar(20)='XYZ'; +select @v += 'abc', @v2 += 'xyz'; +select @v, @v2 +GO + +declare @a int = 1, @b int = 2; +select @a = 2, @b = @a + 2 +select @a, @b +GO + +declare @a int = 1, @b int = 2; +select @a += 2, @b -= @a + 2 +select @a, @b +GO + +-- xml methods +DECLARE @a bit = 1 +DECLARE @xml XML = ' ' +SELECT @a |= @xml.exist('/artists/artist/@name') +select @a +GO + +DECLARE @a bit = 1 +DECLARE @xml XML; +SELECT @xml = ' ', @a |= @xml.exist('/artists/artist/@name') +select @a +GO + +-- test all kind of udts +create type udt from NCHAR +go + +declare @a udt +select @a = 'anc' +select @a +GO + +DROP type udt +GO + +create type varchar_max from varchar(max) +GO + +DECLARE @a varchar_max +SELECT @a = '12345678901234567890123456789012345'; +SELECT LEN(@a), DATALENGTH(@a) +SELECT @a +GO + +DROP type varchar_max +GO + +create type num_def from numeric +GO + +declare @a numeric; +declare @b num_def; +SET @a=100.41; +SET @b=200.82; +SELECT @a, @b +select @a+@b as r; +GO + +drop type num_def +GO + +/* + * select/update test + */ +create table local_var_tst (id int) +GO + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (6) +GO + +-- txn does not affect local variables +begin tran +declare @i int +update local_var_tst set id = 5, @i = id * 5 +select @i +ROLLBACK tran +select @i +GO + +select * from local_var_tst; +GO + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +GO + +-- should return 4 +declare @i int +select @i = 1 +select @i = id * 2 from local_var_tst where id = @i +select @i +GO + +declare @i int +select @i = 1 +select @i = @i + id * 2 from local_var_tst +select @i +GO + +declare @i int +select @i = 1 +select @i = id * 2 + @i from local_var_tst +select @i +GO + +declare @i int +select @i = 1 +select @i += id * 2 from local_var_tst +select @i +GO + +-- 3 parts name +declare @i int +select @i = 1 +select @i += master.dbo.local_var_tst.id * 2 from local_var_tst +select @i +GO + +-- local var name same as column +declare @id int = 1 +select @id += master.dbo.local_var_tst.id * 2 from local_var_tst +select @id +GO + +-- should throw an error +declare @i int +declare @j int +set @i = 10 +set @j = 0; +select @i += (select @j = @j + id from local_var_tst) +select @i +GO + +TRUNCATE table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +GO + +DECLARE @ans INT +SELECT @ans = AVG(id) FROM local_var_tst +select @ans +GO + +-- local variable inside functions +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + SELECT @ans = AVG(id) FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func(); +GO + +DROP FUNCTION var_inside_func(); +GO + +-- show throw an error +CREATE FUNCTION var_inside_func() +RETURNS @tab table (a int) as +BEGIN + DECLARE @ans INT + SELECT @ans += id from local_var_tst + select @ans +END +GO + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + SELECT @ans += id FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func() +go + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func(@def int) +RETURNS INT AS +BEGIN + DECLARE @ans INT; + select @ans = @def; + SELECT @ans += id FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func(0) +go + +declare @def int = 1; +select var_inside_func(@def) +go + +drop function if exists var_inside_func +go + +CREATE FUNCTION var_inside_func() +RETURNS INT AS +BEGIN + DECLARE @ans INT + select @ans = 0 + SELECT @ans += id + @ans FROM local_var_tst + RETURN @ans +END +GO + +select var_inside_func() +go + +drop function if exists var_inside_func +go + +-- variable with procedure +CREATE PROCEDURE var_with_procedure (@a numeric(10,4) OUTPUT) AS +BEGIN + SET @a=100.41; + select @a as a; +END; +GO + +exec var_with_procedure 2.000; +GO + +-- value of @out should remain 2.000 +declare @out numeric(10,4); +set @out = 2.000; +exec var_with_procedure 2.000; +select @out +GO + +drop procedure var_with_procedure; +GO + +CREATE PROCEDURE var_with_procedure_1 (@a numeric(10,4) OUTPUT, @b numeric(10,4) OUTPUT) AS +BEGIN + SET @a=100.41; + SET @b=200.82; + select @a+@b as r; +END; +GO + +EXEC var_with_procedure_1 2.000, 3.000; +GO + +-- value of @a should be 100 +DECLARE @a INT; +EXEC var_with_procedure_1 @a OUT, 3.000; +SELECT @a; +GO + +drop procedure var_with_procedure_1; +GO + +CREATE PROCEDURE var_with_procedure_2 +AS +BEGIN + declare @a int + declare @b int + set @a = 1 + return + select @b=@a+1 +END +GO + +exec var_with_procedure_2 +GO + +DROP PROCEDURE var_with_procedure_2 +GO + +-- insert testing with local variables +truncate table dbo.local_var_tst +go + +-- should throw an error +declare @a int = 1 +insert into local_var_tst select @a = @a + 1 +GO + +-- syntax error +declare @a int = 1 +insert into local_var_tst values (@a = @a + 1) +GO + +declare @a int = 1 +insert into local_var_tst values (@a + 1) +GO + +-- output clause with insert +declare @a int = 1 +declare @mytbl table(a int) +insert local_var_tst output inserted.id into @mytbl values (@a + 1) +select * from @mytbl +GO + +-- output clause with delete +declare @a int = 1 +declare @mytbl table(a int) +delete local_var_tst output deleted.id into @mytbl where id = @a + 1 +select * from @mytbl +GO + +drop table dbo.local_var_tst +go + +create table local_var_tst_1 (a int, b int) +GO + +insert into local_var_tst_1 values (1,3), (2, 4) +go + +-- select test with multi-variable assignment + +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += b from local_var_tst_1 +select @a, @b +go + +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += @a + b from local_var_tst_1 +select @a, @b +go + +declare @a int = 0 +declare @b int = 0 +select @a += a, @b += @a + ~b from local_var_tst_1 +select @a, @b +go + +drop table local_var_tst_1 +go + +create table local_var_str_tst (id varchar(100)) +GO + +insert into local_var_str_tst values ('abc'), (' '), ('def') +GO + +declare @i varchar(1000) +set @i = '' +select @i = @i + id from local_var_str_tst +select @i +go + +declare @i varchar(1000) +set @i = '' +select @i = id + @i from local_var_str_tst +select @i +go + +declare @i varchar(1000) +set @i = '' +select @i += id from local_var_str_tst +select @i +go + +declare @i varchar(1000) +set @i = '' +select @i = reverse(@i + 'id') from local_var_str_tst +select @i +go + +declare @i varchar(1000) +set @i = '' +select @i += reverse(id) from local_var_str_tst +select @i +go + +declare @i varchar(1000) +set @i = 'abc' +select @i = reverse(@i) +select @i +go + +-- function call like trim, ltrim, etc will be rewritten by ANTLR +declare @i varchar(1000) +set @i = ' ' +select @i += id from local_var_str_tst +select len(@i), @i +select @i = trim(@i) +select len(@i), @i +go + +drop table local_var_str_tst; +go + +-- $PARTITION is rewritten by ANTLR +CREATE PARTITION FUNCTION RangePF1 ( INT ) +AS RANGE RIGHT FOR VALUES (10, 100, 1000) ; +GO + +declare @res int = -1; +SELECT @res = $PARTITION.RangePF1 (10); +select @res +select 1 where @res = $PARTITION.RangePF1 (10); +SELECT @res = $PARTITION.RangePF1 (@res); +select @res +GO + +DROP PARTITION FUNCTION RangePF1 +GO + +CREATE SEQUENCE CountBy1 + START WITH 1 + INCREMENT BY 1 ; +GO + +-- NEXT VALUE FOR gets re-written by ANTLR +DECLARE @myvar1 BIGINT = NEXT VALUE FOR CountBy1 ; +DECLARE @myvar2 BIGINT ; +DECLARE @myvar3 BIGINT ; +select @myvar2 = NEXT VALUE FOR CountBy1 ; +SELECT @myvar3 = NEXT VALUE FOR CountBy1 ; +SELECT @myvar1 AS myvar1, @myvar2 AS myvar2, @myvar3 AS myvar3 ; +GO + +DROP SEQUENCE CountBy1 +GO + +-- any @@ is also re-written by ANTLR +declare @pid int = 0 +select @pid += @@spid +select 1 where @pid = @@spid +go + +-- float point notation also gets rewritten by ANTLR e.g., 2.1E, -.2e+, -2.e- +declare @a float = 0 +select @a = 2.1E +select @a +select @a = -.2e+ +select @a +select @a = -2.e- +select @a +go + +-- variables only in select target list shows dynamic behavior +create table local_var_tst (id int) +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (1) +GO + +declare @i int = 1 +declare @j int = 0 +select @j += id, @i = id + 1 from local_var_tst where id = @i +select @i, @j +go + +declare @i int = 1 +select @i = id * 2 from local_var_tst where id = @i +select @i +GO + + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +GO + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +GO + +set babelfish_statistics profile On; +GO + +declare @i int = 1 +declare @j int = 0 +select @j += id, @i = id + 1 from local_var_tst where id = @i +select @i, @j +go + +declare @i int = 1 +select @i = @i * 2 from local_var_tst where id = @i +select @i +GO + +set babelfish_statistics profile OFF +GO + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +GO + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +GO + +-- declared variable name with length > 63 +declare @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr += 1 +select @abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO + +-- variable names starting with @@ +declare @@a int = 1; +select @@a = @@a + 1 +select @@a +GO + +declare @@a int = 1; +select @@a += 1 +select @@a +GO + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr + 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO + +truncate table local_var_tst +GO + +insert into local_var_tst values (1) +insert into local_var_tst values (2) +insert into local_var_tst values (1) +GO + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr + id from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr = id + @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO + +declare @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr int = 1 +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr += id from local_var_tst +select @@abcbjbnjfbjrnfjrnfkrelnfksnrfenjkfrfrfrfrfrfnknslkrnflkernklfnkmklfr +GO + +truncate table local_var_tst +GO + +insert into local_var_tst values (1) +GO + +select set_config('babelfishpg_tsql.explain_timing', 'off', false); +GO + +select set_config('babelfishpg_tsql.explain_summary', 'off', false); +GO + +set babelfish_statistics profile On; +GO + +-- error while evaluating const expression +declare @a int = 1; +select @a = 1 / 0 from local_var_tst +select * from local_var_tst where id = @a +GO + +set babelfish_statistics profile OFF +GO + +select set_config('babelfishpg_tsql.explain_timing', 'on', false); +GO + +select set_config('babelfishpg_tsql.explain_summary', 'on', false); +GO + +drop table local_var_tst +GO diff --git a/test/python/expected/sql_validation_framework/expected_create.out b/test/python/expected/sql_validation_framework/expected_create.out index 933bf058c1..cb781f8376 100644 --- a/test/python/expected/sql_validation_framework/expected_create.out +++ b/test/python/expected/sql_validation_framework/expected_create.out @@ -32,6 +32,7 @@ Could not find tests for function sys.openjson_simple Could not find tests for function sys.openjson_with Could not find tests for function sys.openquery_internal Could not find tests for function sys.patindex_ai_collations +Could not find tests for function sys.pltsql_assign_var Could not find tests for function sys.remove_accents_internal_using_cache Could not find tests for function sys.role_id Could not find tests for function sys.sp_columns_managed_internal @@ -139,6 +140,7 @@ Could not find upgrade tests for function sys.openquery_internal Could not find upgrade tests for function sys.options Could not find upgrade tests for function sys.patindex_ai_collations Could not find upgrade tests for function sys.pgerror +Could not find upgrade tests for function sys.pltsql_assign_var Could not find upgrade tests for function sys.remove_accents_internal_using_cache Could not find upgrade tests for function sys.role_id Could not find upgrade tests for function sys.servername diff --git a/test/python/expected/upgrade_validation/expected_dependency.out b/test/python/expected/upgrade_validation/expected_dependency.out index 9deafc30f4..687160fa64 100644 --- a/test/python/expected/upgrade_validation/expected_dependency.out +++ b/test/python/expected/upgrade_validation/expected_dependency.out @@ -558,6 +558,7 @@ Function sys.options() Function sys.original_login() Function sys.patindex_ai_collations(character varying,character varying) Function sys.pgerror() +Function sys.pltsql_assign_var(integer,anyelement) Function sys.pltsql_call_handler() Function sys.pltsql_inline_handler(internal) Function sys.pltsql_validator(oid)