diff --git a/src/sql/engine/cmd/ob_analyze_executor.cpp b/src/sql/engine/cmd/ob_analyze_executor.cpp index 96fd2e4fd..39777131a 100644 --- a/src/sql/engine/cmd/ob_analyze_executor.cpp +++ b/src/sql/engine/cmd/ob_analyze_executor.cpp @@ -19,6 +19,7 @@ #include "share/stat/ob_dbms_stats_lock_unlock.h" #include "share/stat/ob_dbms_stats_utils.h" #include "share/stat/ob_opt_stat_manager.h" +#include "share/stat/ob_opt_stat_monitor_manager.h" //#define COMPUTE_FREQUENCY_HISTOGRAM // "SELECT /*+NO_USE_PX*/ col, sum(val) over (order by col rows between unbounded preceding and current row) " @@ -78,6 +79,8 @@ int ObAnalyzeExecutor::execute(ObExecContext &ctx, ObAnalyzeStmt &stmt) LOG_WARN("failed to add table info", K(ret)); } else if (OB_FAIL(ObDbmsStatsLockUnlock::check_stat_locked(ctx, param))) { LOG_WARN("failed check stat locked", K(ret)); + } else if (OB_FAIL(ObOptStatMonitorManager::flush_database_monitoring_info(ctx, false, true))) { + LOG_WARN("failed to do flush database monitoring info", K(ret)); } else if (OB_FAIL(ObDbmsStatsExecutor::gather_table_stats(ctx, param))) { LOG_WARN("failed to gather table stats", K(ret)); } else if (OB_FAIL(pl::ObDbmsStats::update_stat_cache(session->get_rpc_tenant_id(), param))) { diff --git a/src/sql/engine/expr/ob_expr_func_part_hash.cpp b/src/sql/engine/expr/ob_expr_func_part_hash.cpp index 6cf76b542..cb0848acf 100644 --- a/src/sql/engine/expr/ob_expr_func_part_hash.cpp +++ b/src/sql/engine/expr/ob_expr_func_part_hash.cpp @@ -269,8 +269,9 @@ int ObExprFuncPartHash::cg_expr(ObExprCGCtx &, const ObRawExpr &, ObExpr &rt_exp int ret = OB_SUCCESS; if (lib::is_mysql_mode()) { if (1 != rt_expr.arg_cnt_) { - ret = OB_ERR_UNEXPECTED; + ret = OB_INVALID_ARGUMENT; LOG_WARN("expect one parameter in mysql", K(ret)); + LOG_USER_ERROR(OB_INVALID_ARGUMENT, "part hash"); } } diff --git a/src/sql/engine/expr/ob_expr_regexp.cpp b/src/sql/engine/expr/ob_expr_regexp.cpp index 800312420..5567ad0a0 100644 --- a/src/sql/engine/expr/ob_expr_regexp.cpp +++ b/src/sql/engine/expr/ob_expr_regexp.cpp @@ -170,7 +170,16 @@ int ObExprRegexp::eval_regexp(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_ ObDatum *text = NULL; ObDatum *pattern = NULL; if (OB_FAIL(expr.eval_param_value(ctx, text, pattern))) { - LOG_WARN("evaluate parameters failed", K(ret)); + if (ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql + ret = OB_SUCCESS; + expr_datum.set_null(); + const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_); + int64_t charset_name_len = strlen(charset_name); + const char *tmp_char = NULL; + LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast(charset_name_len), charset_name, 0, tmp_char); + } else { + LOG_WARN("evaluate parameters failed", K(ret)); + } } else if (text->is_null() || pattern->is_null()) { expr_datum.set_null(); } else if (OB_UNLIKELY(expr.arg_cnt_ != 2 || diff --git a/src/sql/engine/expr/ob_expr_regexp_instr.cpp b/src/sql/engine/expr/ob_expr_regexp_instr.cpp index 9de4638ef..d219975c8 100644 --- a/src/sql/engine/expr/ob_expr_regexp_instr.cpp +++ b/src/sql/engine/expr/ob_expr_regexp_instr.cpp @@ -183,7 +183,16 @@ int ObExprRegexpInstr::eval_regexp_instr( ObDatum *subexpr= NULL; if (OB_FAIL(expr.eval_param_value( ctx, text, pattern, position, occurrence, return_opt, match_type, subexpr))) { - LOG_WARN("evaluate parameters failed", K(ret)); + if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql + ret = OB_SUCCESS; + expr_datum.set_null(); + const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_); + int64_t charset_name_len = strlen(charset_name); + const char *tmp_char = NULL; + LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast(charset_name_len), charset_name, 0, tmp_char); + } else { + LOG_WARN("evaluate parameters failed", K(ret)); + } } else if (OB_UNLIKELY(expr.arg_cnt_ < 2 || (expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_GENERAL_CI && expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_BIN && diff --git a/src/sql/engine/expr/ob_expr_regexp_like.cpp b/src/sql/engine/expr/ob_expr_regexp_like.cpp index b23a5a247..cd296276b 100644 --- a/src/sql/engine/expr/ob_expr_regexp_like.cpp +++ b/src/sql/engine/expr/ob_expr_regexp_like.cpp @@ -141,7 +141,16 @@ int ObExprRegexpLike::eval_regexp_like( ObDatum *pattern = NULL; ObDatum *match_type = NULL; if (OB_FAIL(expr.eval_param_value(ctx, text, pattern, match_type))) { - LOG_WARN("evaluate parameters failed", K(ret)); + if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql + ret = OB_SUCCESS; + expr_datum.set_null(); + const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_); + int64_t charset_name_len = strlen(charset_name); + const char *tmp_char = NULL; + LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast(charset_name_len), charset_name, 0, tmp_char); + } else { + LOG_WARN("evaluate parameters failed", K(ret)); + } } else if (OB_UNLIKELY(expr.arg_cnt_ < 2 || (expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_GENERAL_CI && expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_BIN && diff --git a/src/sql/engine/expr/ob_expr_regexp_replace.cpp b/src/sql/engine/expr/ob_expr_regexp_replace.cpp index fdd306825..f98e6fbe6 100644 --- a/src/sql/engine/expr/ob_expr_regexp_replace.cpp +++ b/src/sql/engine/expr/ob_expr_regexp_replace.cpp @@ -220,7 +220,16 @@ int ObExprRegexpReplace::eval_regexp_replace( ObEvalCtx::TempAllocGuard alloc_guard(ctx); ObIAllocator &tmp_alloc = alloc_guard.get_allocator(); if (OB_FAIL(expr.eval_param_value(ctx, text, pattern, to, position, occurrence, match_type))) { - LOG_WARN("evaluate parameters failed", K(ret)); + if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql + ret = OB_SUCCESS; + expr_datum.set_null(); + const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_); + int64_t charset_name_len = strlen(charset_name); + const char *tmp_char = NULL; + LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast(charset_name_len), charset_name, 0, tmp_char); + } else { + LOG_WARN("evaluate parameters failed", K(ret)); + } } else if (lib::is_oracle_mode() && pattern->is_null()) { if (text->is_null()) { expr_datum.set_null(); diff --git a/src/sql/engine/expr/ob_expr_regexp_substr.cpp b/src/sql/engine/expr/ob_expr_regexp_substr.cpp index 42ab81a16..9784feb23 100644 --- a/src/sql/engine/expr/ob_expr_regexp_substr.cpp +++ b/src/sql/engine/expr/ob_expr_regexp_substr.cpp @@ -197,7 +197,16 @@ int ObExprRegexpSubstr::eval_regexp_substr( int64_t occur = 1; int64_t subexpr_val = 0; if (OB_FAIL(expr.eval_param_value(ctx, text, pattern, position, occurrence, match_type, subexpr))) { - LOG_WARN("evaluate parameters failed", K(ret)); + if (lib::is_mysql_mode() && ret == OB_ERR_INCORRECT_STRING_VALUE) {//compatible mysql + ret = OB_SUCCESS; + expr_datum.set_null(); + const char *charset_name = ObCharset::charset_name(expr.args_[0]->datum_meta_.cs_type_); + int64_t charset_name_len = strlen(charset_name); + const char *tmp_char = NULL; + LOG_USER_WARN(OB_ERR_INVALID_CHARACTER_STRING, static_cast(charset_name_len), charset_name, 0, tmp_char); + } else { + LOG_WARN("evaluate parameters failed", K(ret)); + } } else if (OB_UNLIKELY(expr.arg_cnt_ < 2 || (expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_GENERAL_CI && expr.args_[0]->datum_meta_.cs_type_ != CS_TYPE_UTF8MB4_BIN && diff --git a/src/sql/parser/ob_fast_parser.cpp b/src/sql/parser/ob_fast_parser.cpp index 4ba9ce2fe..e90f7e194 100644 --- a/src/sql/parser/ob_fast_parser.cpp +++ b/src/sql/parser/ob_fast_parser.cpp @@ -1372,6 +1372,79 @@ inline char* ObFastParserBase::parse_strndup(const char *str, size_t nbyte, char return buf; } +inline char* ObFastParserOracle::parse_strndup_with_trim_space_for_new_line(const char *str, + size_t nbyte, + char *buf, + int *connection_collation, + int64_t *new_len) +{ + MEMMOVE(buf, str, nbyte); + int64_t idx = 0; + for (int64_t i = 0; i < nbyte; ++i) { + if (idx > 0 && buf[i] == '\n') { + int64_t j = idx - 1; + bool is_found = false; + do { + is_found = false; + if (buf[j] == ' ' || buf[j] == '\t') { + -- j; + -- idx; + is_found = true; + } else { + switch (*connection_collation) { + case 28/*CS_TYPE_GBK_CHINESE_CI*/: + case 87/*CS_TYPE_GBK_BIN*/: + case 216/*CS_TYPE_GB18030_2022_BIN*/: + case 217/*CS_TYPE_GB18030_2022_PINYIN_CI*/: + case 218/*CS_TYPE_GB18030_2022_PINYIN_CS*/: + case 219/*CS_TYPE_GB18030_2022_RADICAL_CI*/: + case 220/*CS_TYPE_GB18030_2022_RADICAL_CS*/: + case 221/*CS_TYPE_GB18030_2022_STROKE_CI*/: + case 222/*CS_TYPE_GB18030_2022_STROKE_CS*/: + case 248/*CS_TYPE_GB18030_CHINESE_CI*/: + case 249/*CS_TYPE_GB18030_BIN*/: { + if (j - 1 >= 0) { + if (buf[j - 1] == (char)0xa1 && + buf[j] == (char)0xa1) {//gbk multi byte space + j = j - 2; + idx = idx - 2; + is_found = true; + } + } + break; + } + case 45/*CS_TYPE_UTF8MB4_GENERAL_CI*/: + case 46/*CS_TYPE_UTF8MB4_BIN*/: + case 63/*CS_TYPE_BINARY*/: + case 224/*CS_TYPE_UTF8MB4_UNICODE_CI*/: { + //case 8/*CS_TYPE_LATIN1_SWEDISH_CI*/: + //case 47/*CS_TYPE_LATIN1_BIN*/: + if (j - 2 >= 0) { + if (buf[j - 2] == (char)0xe3 && + buf[j - 1] == (char)0x80 && + buf[j] == (char)0x80) {//utf8 multi byte space + j = j - 3; + idx = idx - 3; + is_found = true; + } + } + break; + } + default: + break; + } + } + } while (j >= 0 && is_found); + buf[idx++] = buf[i]; + } else { + buf[idx++] = buf[i]; + } + } + *new_len -= (nbyte - idx); + buf[*new_len] = '\0'; + return buf; +} + char *ObFastParserBase::parse_strdup_with_replace_multi_byte_char( const char *str, const size_t dup_len, char *out_str, int64_t &out_len) { @@ -2894,8 +2967,10 @@ int ObFastParserOracle::process_string(const bool in_q_quote) node->text_len_ = text_len; node->str_len_ = str_len; node->raw_text_ = raw_sql_.ptr(cur_token_begin_pos_); + int cs_type = ObCharset::is_gb_charset(charset_type_) ? CS_TYPE_GBK_BIN : + (CHARSET_UTF8MB4 == charset_type_ ? CS_TYPE_UTF8MB4_BIN : CS_TYPE_INVALID); if (node->str_len_ > 0) { - node->str_value_ = parse_strndup(tmp_buf_, tmp_buf_len_, buf); + node->str_value_ = parse_strndup_with_trim_space_for_new_line(tmp_buf_, tmp_buf_len_, buf, &cs_type, &node->str_len_); } // buf points to the beginning of the next available memory buf += str_len + 1; diff --git a/src/sql/parser/ob_fast_parser.h b/src/sql/parser/ob_fast_parser.h index a5e514cfe..77354b7fb 100644 --- a/src/sql/parser/ob_fast_parser.h +++ b/src/sql/parser/ob_fast_parser.h @@ -686,6 +686,11 @@ private: */ int process_string(const bool in_q_quote); int process_identifier_begin_with_n(); + char *parse_strndup_with_trim_space_for_new_line(const char *str, + size_t nbyte, + char *buf, + int *connection_collation, + int64_t *new_len); private: DISALLOW_COPY_AND_ASSIGN(ObFastParserOracle); diff --git a/src/sql/parser/parse_malloc.cpp b/src/sql/parser/parse_malloc.cpp index cd28c1e3f..bb817a188 100644 --- a/src/sql/parser/parse_malloc.cpp +++ b/src/sql/parser/parse_malloc.cpp @@ -103,6 +103,83 @@ char *parse_strndup(const char *str, size_t nbyte, void *malloc_pool) return new_str; } +//oracle trim space for string, issue: +char *parse_strndup_with_trim_space_for_new_line(const char *str, size_t nbyte, void *malloc_pool, + int *connection_collation, int64_t *new_len) +{ + char *new_str = NULL; + if (OB_ISNULL(str) || OB_ISNULL(malloc_pool) || OB_ISNULL(connection_collation) || OB_ISNULL(new_len)) { + } else { + if (OB_LIKELY(NULL != (new_str = static_cast(parse_malloc(nbyte + 1, malloc_pool))))) { + MEMMOVE(new_str, str, nbyte); + int64_t idx = 0; + for (int64_t i = 0; i < nbyte; ++i) { + if (idx > 0 && new_str[i] == '\n') { + int64_t j = idx - 1; + bool is_found = false; + do { + is_found = false; + if (new_str[j] == ' ' || new_str[j] == '\t') { + -- j; + -- idx; + is_found = true; + } else { + switch (*connection_collation) { + case 28/*CS_TYPE_GBK_CHINESE_CI*/: + case 87/*CS_TYPE_GBK_BIN*/: + case 216/*CS_TYPE_GB18030_2022_BIN*/: + case 217/*CS_TYPE_GB18030_2022_PINYIN_CI*/: + case 218/*CS_TYPE_GB18030_2022_PINYIN_CS*/: + case 219/*CS_TYPE_GB18030_2022_RADICAL_CI*/: + case 220/*CS_TYPE_GB18030_2022_RADICAL_CS*/: + case 221/*CS_TYPE_GB18030_2022_STROKE_CI*/: + case 222/*CS_TYPE_GB18030_2022_STROKE_CS*/: + case 248/*CS_TYPE_GB18030_CHINESE_CI*/: + case 249/*CS_TYPE_GB18030_BIN*/: { + if (j - 1 >= 0) { + if (new_str[j - 1] == (char)0xa1 && + new_str[j] == (char)0xa1) {//gbk multi byte space + j = j - 2; + idx = idx - 2; + is_found = true; + } + } + break; + } + case 45/*CS_TYPE_UTF8MB4_GENERAL_CI*/: + case 46/*CS_TYPE_UTF8MB4_BIN*/: + case 63/*CS_TYPE_BINARY*/: + case 224/*CS_TYPE_UTF8MB4_UNICODE_CI*/: { + //case 8/*CS_TYPE_LATIN1_SWEDISH_CI*/: + //case 47/*CS_TYPE_LATIN1_BIN*/: + if (j - 2 >= 0) { + if (new_str[j - 2] == (char)0xe3 && + new_str[j - 1] == (char)0x80 && + new_str[j] == (char)0x80) {//utf8 multi byte space + j = j - 3; + idx = idx - 3; + is_found = true; + } + } + break; + } + default: + break; + } + } + } while (j >= 0 && is_found); + new_str[idx++] = new_str[i]; + } else { + new_str[idx++] = new_str[i]; + } + } + *new_len -= (nbyte - idx); + new_str[*new_len] = '\0'; + } + } + return new_str; +} + char *parse_strdup(const char *str, void *malloc_pool, int64_t *out_len) { char *out_str = NULL; diff --git a/src/sql/parser/parse_malloc.h b/src/sql/parser/parse_malloc.h index feeee14c5..2516e643f 100644 --- a/src/sql/parser/parse_malloc.h +++ b/src/sql/parser/parse_malloc.h @@ -29,6 +29,7 @@ extern void parse_free(void *ptr); extern char *parse_strndup(const char *str, size_t nbyte, void *malloc_pool); extern char *parse_strdup(const char *str, void *malloc_pool, int64_t *out_len); extern char *parse_str_convert_utf8(const struct ObCharsetInfo* src_cs, const char *str, void *malloc_pool, int64_t *out_len, int *extra_errno); +extern char *parse_strndup_with_trim_space_for_new_line(const char *str, size_t nbyte, void *malloc_pool, int *connection_collation, int64_t *new_len); extern char *strndup_with_prefix(const char *prefix, const char *str, size_t nbyte, void *malloc_pool); extern char *strndup_with_prefix_and_postfix(const char *prefix, const char *postfix, const char *str, size_t nbyte, void *malloc_pool); extern char *cp_str_value(const char *src, const size_t nbyte, void *malloc_pool); diff --git a/tools/deploy/mysql_test/test_suite/expr/r/mysql/func_regexp.result b/tools/deploy/mysql_test/test_suite/expr/r/mysql/func_regexp.result index 7feeb51a0..07313b368 100644 --- a/tools/deploy/mysql_test/test_suite/expr/r/mysql/func_regexp.result +++ b/tools/deploy/mysql_test/test_suite/expr/r/mysql/func_regexp.result @@ -6374,3 +6374,52 @@ select 'a' collate latin1_bin regexp 'A' collate latin1_swedish_ci; ERROR HY000: Illegal mix of collations select 'a' collate latin1_swedish_ci regexp 'A' collate latin1_bin; ERROR HY000: Illegal mix of collations +drop database ly; +create database ly character set GB18030; +use ly; +DROP TABLE IF EXISTS `table10_bigint`; +Warnings: +Note 1051 Unknown table 'ly.table10_bigint' +CREATE TABLE `table10_bigint` ( +`col_smallint_signed` smallint(6) DEFAULT NULL, +`col_decimal_20_0_signed` decimal(20,0) DEFAULT NULL, +`col_tinyint_unsigned` tinyint(3) unsigned DEFAULT NULL, +`col_mediumint_signed` mediumint(9) DEFAULT NULL, +`col_decimal_30_5_signed` decimal(30,5) DEFAULT NULL, +`col_int` int(11) DEFAULT NULL, +`col_smallint_unsigned` smallint(5) unsigned DEFAULT NULL, +`col_decimal_30_5` decimal(30,5) DEFAULT NULL, +`col_tinyint_signed` tinyint(4) DEFAULT NULL, +`col_decimal_20_0` decimal(20,0) DEFAULT NULL, +`pk` bigint(20) NOT NULL, +`col_int_unsigned` int(10) unsigned DEFAULT NULL, +`col_datetime` datetime DEFAULT NULL, +`col_mediumint_unsigned` mediumint(8) unsigned DEFAULT NULL, +`col_bigint_signed` bigint(20) DEFAULT NULL, +`col_integer_unsigned` int(10) unsigned DEFAULT NULL, +`col_char_30` char(30) DEFAULT NULL, +`col_integer` int(11) DEFAULT NULL, +`col_bigint_unsigned` bigint(20) unsigned DEFAULT NULL, +`col_int_signed` int(11) DEFAULT NULL, +`col_timestamp` timestamp NULL DEFAULT NULL, +`col_tinyint` tinyint(4) DEFAULT NULL, +`col_char_20` char(20) DEFAULT NULL, +`col_decimal_20_0_unsigned` decimal(20,0) unsigned DEFAULT NULL, +`col_smallint` smallint(6) DEFAULT NULL, +`col_decimal_30_5_unsigned` decimal(30,5) unsigned DEFAULT NULL, +`col_date` date DEFAULT NULL, +`col_integer_signed` int(11) DEFAULT NULL, +`col_mediumint` mediumint(9) DEFAULT NULL, +`col_bigint` bigint(20) DEFAULT NULL, +PRIMARY KEY (`pk`) +) DEFAULT CHARSET = gb18030 ROW_FORMAT = DYNAMIC ; +INSERT INTO `table10_bigint` VALUES (9,3,NULL,7,6.00000,NULL,NULL,NULL,NULL,8,1,4,'2007-12-25 08:02:41',2,8,NULL,'kqpbiirnugot',NULL,NULL,0,'2006-02-12 16:48:16',NULL,'get',NULL,NULL,NULL,'2006-10-20',NULL,5,3),(NULL,NULL,NULL,NULL,7.00000,7,9,NULL,9,2,2,NULL,'2000-08-08 04:39:35',7,NULL,NULL,'',5,NULL,NULL,'2003-10-07 10:09:45',1,'r',5,NULL,NULL,'2002-10-27',NULL,7,NULL),(NULL,6,NULL,NULL,1.00000,NULL,NULL,8.00000,4,8,3,NULL,'2004-08-13 10:53:30',5,8,6,'d',NULL,NULL,9,'2007-07-26 10:08:34',NULL,NULL,9,NULL,NULL,'2003-05-10',NULL,NULL,NULL),(3,2,NULL,NULL,1.00000,6,5,5.00000,NULL,NULL,4,NULL,'2000-06-15 20:10:58',NULL,NULL,0,'come',3,9,3,'2005-02-03 16:00:00',NULL,'',NULL,3,0.00000,'2001-07-11',NULL,NULL,3),(6,NULL,NULL,9,NULL,NULL,8,4.00000,8,NULL,5,NULL,'2000-11-19 22:25:40',NULL,1,6,'j',7,8,5,'2005-03-27 15:01:52',8,'w',NULL,5,NULL,'2003-02-27',6,NULL,NULL),(NULL,5,4,1,3.00000,NULL,NULL,NULL,2,6,6,NULL,'2009-03-12 00:00:00',8,NULL,4,'',6,3,NULL,'2002-05-23 11:10:50',NULL,'now',2,4,NULL,'2004-04-03',NULL,5,6),(7,NULL,4,NULL,1.00000,NULL,NULL,NULL,5,NULL,7,NULL,'2006-09-25 12:07:13',7,NULL,NULL,'z',7,NULL,9,'2001-01-07 16:00:00',0,'want',5,0,3.00000,'2009-07-12',NULL,NULL,3),(NULL,NULL,8,7,NULL,NULL,NULL,8.00000,NULL,1,8,0,'2001-10-23 00:00:00',1,6,NULL,'',NULL,8,7,'2008-02-20 03:04:52',2,'b',NULL,9,NULL,'2008-01-22',4,7,6),(NULL,9,NULL,8,7.00000,0,8,5.00000,3,8,9,7,'2002-07-27 22:52:55',4,NULL,NULL,'yes',NULL,3,NULL,'2008-02-24 08:16:18',9,'',NULL,0,NULL,'2003-11-02',6,9,NULL),(2,NULL,7,NULL,2.00000,1,NULL,2.00000,6,6,10,NULL,'2007-06-02 02:12:10',NULL,NULL,NULL,'',NULL,NULL,1,'2009-12-16 00:47:00',2,'I',NULL,3,1.00000,'2008-02-26',NULL,8,5); +set names GB18030; +SELECT TRIM( SUBSTRING( SUBSTRING( '∷ ∶ ∫ ∮ ∝ ∞ ∧ ∨ ∑ ∏ ∪ ∩ ∈ ∵ ∴ ⊥ ∥ ∠ ⌒ ⊙ √∟⊿ ㏒ ㏑ % ‰' , 1, LEAST( 228, 20 ) ) , 1 , LEAST( 228, 20 ) ) ) NOT REGEXP CONCAT( 'tu', '%' ) FROM table10_bigint WHERE col_int NOT IN ( 5387431054241955840 , 13633803446934044672 , 65066 , 45808 , 6755399441055744000 ) ORDER BY col_char_20 DESC , pk ASC LIMIT 6 OFFSET 1; +TRIM( SUBSTRING( SUBSTRING( ' √∟ % ' , 1, LEAST( 228, 20 ) ) , 1 , LEAST( 228, 20 ) ) ) NOT REGEXP CONCAT( 'tu', '%' ) +NULL +NULL +NULL +Warnings: +Warning 1300 Invalid utf16 character string: '' +drop database ly; diff --git a/tools/deploy/mysql_test/test_suite/expr/t/func_regexp.test b/tools/deploy/mysql_test/test_suite/expr/t/func_regexp.test index 795d8c7a3..681aca47b 100644 --- a/tools/deploy/mysql_test/test_suite/expr/t/func_regexp.test +++ b/tools/deploy/mysql_test/test_suite/expr/t/func_regexp.test @@ -481,4 +481,57 @@ select 'a' collate latin1_swedish_ci regexp 'A' collate latin1_swedish_ci; --error 1267 select 'a' collate latin1_bin regexp 'A' collate latin1_swedish_ci; --error 1267 -select 'a' collate latin1_swedish_ci regexp 'A' collate latin1_bin; \ No newline at end of file +select 'a' collate latin1_swedish_ci regexp 'A' collate latin1_bin; + + +##bug: + +--error 0,1008 +drop database ly; + +create database ly character set GB18030; +use ly; + +DROP TABLE IF EXISTS `table10_bigint`; +CREATE TABLE `table10_bigint` ( + `col_smallint_signed` smallint(6) DEFAULT NULL, + `col_decimal_20_0_signed` decimal(20,0) DEFAULT NULL, + `col_tinyint_unsigned` tinyint(3) unsigned DEFAULT NULL, + `col_mediumint_signed` mediumint(9) DEFAULT NULL, + `col_decimal_30_5_signed` decimal(30,5) DEFAULT NULL, + `col_int` int(11) DEFAULT NULL, + `col_smallint_unsigned` smallint(5) unsigned DEFAULT NULL, + `col_decimal_30_5` decimal(30,5) DEFAULT NULL, + `col_tinyint_signed` tinyint(4) DEFAULT NULL, + `col_decimal_20_0` decimal(20,0) DEFAULT NULL, + `pk` bigint(20) NOT NULL, + `col_int_unsigned` int(10) unsigned DEFAULT NULL, + `col_datetime` datetime DEFAULT NULL, + `col_mediumint_unsigned` mediumint(8) unsigned DEFAULT NULL, + `col_bigint_signed` bigint(20) DEFAULT NULL, + `col_integer_unsigned` int(10) unsigned DEFAULT NULL, + `col_char_30` char(30) DEFAULT NULL, + `col_integer` int(11) DEFAULT NULL, + `col_bigint_unsigned` bigint(20) unsigned DEFAULT NULL, + `col_int_signed` int(11) DEFAULT NULL, + `col_timestamp` timestamp NULL DEFAULT NULL, + `col_tinyint` tinyint(4) DEFAULT NULL, + `col_char_20` char(20) DEFAULT NULL, + `col_decimal_20_0_unsigned` decimal(20,0) unsigned DEFAULT NULL, + `col_smallint` smallint(6) DEFAULT NULL, + `col_decimal_30_5_unsigned` decimal(30,5) unsigned DEFAULT NULL, + `col_date` date DEFAULT NULL, + `col_integer_signed` int(11) DEFAULT NULL, + `col_mediumint` mediumint(9) DEFAULT NULL, + `col_bigint` bigint(20) DEFAULT NULL, + PRIMARY KEY (`pk`) +) DEFAULT CHARSET = gb18030 ROW_FORMAT = DYNAMIC ; + + +INSERT INTO `table10_bigint` VALUES (9,3,NULL,7,6.00000,NULL,NULL,NULL,NULL,8,1,4,'2007-12-25 08:02:41',2,8,NULL,'kqpbiirnugot',NULL,NULL,0,'2006-02-12 16:48:16',NULL,'get',NULL,NULL,NULL,'2006-10-20',NULL,5,3),(NULL,NULL,NULL,NULL,7.00000,7,9,NULL,9,2,2,NULL,'2000-08-08 04:39:35',7,NULL,NULL,'',5,NULL,NULL,'2003-10-07 10:09:45',1,'r',5,NULL,NULL,'2002-10-27',NULL,7,NULL),(NULL,6,NULL,NULL,1.00000,NULL,NULL,8.00000,4,8,3,NULL,'2004-08-13 10:53:30',5,8,6,'d',NULL,NULL,9,'2007-07-26 10:08:34',NULL,NULL,9,NULL,NULL,'2003-05-10',NULL,NULL,NULL),(3,2,NULL,NULL,1.00000,6,5,5.00000,NULL,NULL,4,NULL,'2000-06-15 20:10:58',NULL,NULL,0,'come',3,9,3,'2005-02-03 16:00:00',NULL,'',NULL,3,0.00000,'2001-07-11',NULL,NULL,3),(6,NULL,NULL,9,NULL,NULL,8,4.00000,8,NULL,5,NULL,'2000-11-19 22:25:40',NULL,1,6,'j',7,8,5,'2005-03-27 15:01:52',8,'w',NULL,5,NULL,'2003-02-27',6,NULL,NULL),(NULL,5,4,1,3.00000,NULL,NULL,NULL,2,6,6,NULL,'2009-03-12 00:00:00',8,NULL,4,'',6,3,NULL,'2002-05-23 11:10:50',NULL,'now',2,4,NULL,'2004-04-03',NULL,5,6),(7,NULL,4,NULL,1.00000,NULL,NULL,NULL,5,NULL,7,NULL,'2006-09-25 12:07:13',7,NULL,NULL,'z',7,NULL,9,'2001-01-07 16:00:00',0,'want',5,0,3.00000,'2009-07-12',NULL,NULL,3),(NULL,NULL,8,7,NULL,NULL,NULL,8.00000,NULL,1,8,0,'2001-10-23 00:00:00',1,6,NULL,'',NULL,8,7,'2008-02-20 03:04:52',2,'b',NULL,9,NULL,'2008-01-22',4,7,6),(NULL,9,NULL,8,7.00000,0,8,5.00000,3,8,9,7,'2002-07-27 22:52:55',4,NULL,NULL,'yes',NULL,3,NULL,'2008-02-24 08:16:18',9,'',NULL,0,NULL,'2003-11-02',6,9,NULL),(2,NULL,7,NULL,2.00000,1,NULL,2.00000,6,6,10,NULL,'2007-06-02 02:12:10',NULL,NULL,NULL,'',NULL,NULL,1,'2009-12-16 00:47:00',2,'I',NULL,3,1.00000,'2008-02-26',NULL,8,5); + +set names GB18030; + +SELECT TRIM( SUBSTRING( SUBSTRING( '∷ ∶ ∫ ∮ ∝ ∞ ∧ ∨ ∑ ∏ ∪ ∩ ∈ ∵ ∴ ⊥ ∥ ∠ ⌒ ⊙ √∟⊿ ㏒ ㏑ % ‰' , 1, LEAST( 228, 20 ) ) , 1 , LEAST( 228, 20 ) ) ) NOT REGEXP CONCAT( 'tu', '%' ) FROM table10_bigint WHERE col_int NOT IN ( 5387431054241955840 , 13633803446934044672 , 65066 , 45808 , 6755399441055744000 ) ORDER BY col_char_20 DESC , pk ASC LIMIT 6 OFFSET 1; + +drop database ly; diff --git a/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/expr_part_hash.result b/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/expr_part_hash.result index 9cd6bffb3..0de8e6003 100644 --- a/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/expr_part_hash.result +++ b/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/expr_part_hash.result @@ -22,7 +22,7 @@ select c2, partition_hash(c2) from t1; select c3, partition_hash(c3) from t1; ERROR HY000: The PARTITION function returns the wrong type select partition_hash(c1, c2) from t1; -ERROR HY000: Internal error +ERROR HY000: Incorrect arguments to part hash select partition_hash(10) from t1; +--------------------+