diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-11-29 10:33:06 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-11-29 10:33:06 +0200 |
commit | 289721de9aca8cdf3bdef1a010477e2d38eebb8d (patch) | |
tree | 50a9f9ea56a7a0b68210e1061ced47951298d2d9 /sql | |
parent | 9962cda52722b77c2a7e0314bbaa2e4f963f55c1 (diff) | |
parent | f5441ef4dac9f3fd5dfe1bfa25a514715fee649f (diff) | |
download | mariadb-git-289721de9aca8cdf3bdef1a010477e2d38eebb8d.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysql_upgrade_service.cc | 18 | ||||
-rw-r--r-- | sql/sql_class.cc | 27 | ||||
-rw-r--r-- | sql/sql_class.h | 3 | ||||
-rw-r--r-- | sql/sql_lex.cc | 5 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 15 | ||||
-rw-r--r-- | sql/sql_yacc_ora.yy | 15 |
6 files changed, 46 insertions, 37 deletions
diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc index 8e2b394594b..68bc111b6a2 100644 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@ -368,8 +368,6 @@ static void get_service_config() */ static void change_service_config() { - char defaults_file[MAX_PATH]; - char default_character_set[64]; char buf[MAX_PATH]; char commandline[3 * MAX_PATH + 19]; int i; @@ -392,22 +390,6 @@ static void change_service_config() */ WritePrivateProfileString("mysqld", "basedir",NULL, service_properties.inifile); - /* - Replace default-character-set with character-set-server, to avoid - "default-character-set is deprecated and will be replaced ..." - message. - */ - default_character_set[0]= 0; - GetPrivateProfileString("mysqld", "default-character-set", NULL, - default_character_set, sizeof(default_character_set), defaults_file); - if (default_character_set[0]) - { - WritePrivateProfileString("mysqld", "default-character-set", NULL, - defaults_file); - WritePrivateProfileString("mysqld", "character-set-server", - default_character_set, defaults_file); - } - sprintf(defaults_file_param,"--defaults-file=%s", service_properties.inifile); sprintf_s(commandline, "\"%s\" \"%s\" \"%s\"", mysqld_path, defaults_file_param, opt_service); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index fbfb742d9ee..bbc46408c04 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3610,7 +3610,7 @@ int select_max_min_finder_subselect::send_data(List<Item> &items) if (!cache) { cache= val_item->get_cache(thd); - switch (val_item->result_type()) { + switch (val_item->cmp_type()) { case REAL_RESULT: op= &select_max_min_finder_subselect::cmp_real; break; @@ -3623,8 +3623,13 @@ int select_max_min_finder_subselect::send_data(List<Item> &items) case DECIMAL_RESULT: op= &select_max_min_finder_subselect::cmp_decimal; break; - case ROW_RESULT: case TIME_RESULT: + if (val_item->field_type() == MYSQL_TYPE_TIME) + op= &select_max_min_finder_subselect::cmp_time; + else + op= &select_max_min_finder_subselect::cmp_str; + break; + case ROW_RESULT: // This case should never be choosen DBUG_ASSERT(0); op= 0; @@ -3669,6 +3674,22 @@ bool select_max_min_finder_subselect::cmp_int() return (val1 < val2); } +bool select_max_min_finder_subselect::cmp_time() +{ + Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0); + longlong val1= cache->val_time_packed(), val2= maxmin->val_time_packed(); + + /* Ignore NULLs for ANY and keep them for ALL subqueries */ + if (cache->null_value) + return (is_all && !maxmin->null_value) || (!is_all && maxmin->null_value); + if (maxmin->null_value) + return !is_all; + + if (fmax) + return(val1 > val2); + return (val1 < val2); +} + bool select_max_min_finder_subselect::cmp_decimal() { Item *maxmin= ((Item_singlerow_subselect *)item)->element_index(0); @@ -3695,7 +3716,7 @@ bool select_max_min_finder_subselect::cmp_str() but added for safety */ val1= cache->val_str(&buf1); - val2= maxmin->val_str(&buf1); + val2= maxmin->val_str(&buf2); /* Ignore NULLs for ANY and keep them for ALL subqueries */ if (cache->null_value) diff --git a/sql/sql_class.h b/sql/sql_class.h index 4dcb0a0d5a5..2c43d1a229d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4899,12 +4899,10 @@ inline void add_to_active_threads(THD *thd) /* This should be called when you want to delete a thd that was not running any queries. - This function will assert that the THD is linked. */ inline void unlink_not_visible_thd(THD *thd) { - thd->assert_linked(); mysql_mutex_lock(&LOCK_thread_count); thd->unlink(); mysql_mutex_unlock(&LOCK_thread_count); @@ -5881,6 +5879,7 @@ public: bool cmp_int(); bool cmp_decimal(); bool cmp_str(); + bool cmp_time(); }; /* EXISTS subselect interface class */ diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 00e1d30f209..b2ce5adaed6 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1642,10 +1642,7 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd) if (c == '-' || c == '+') c= yyGet(); // Skip sign if (!my_isdigit(cs, c)) - { // No digit after sign - state= MY_LEX_CHAR; - break; - } + return ABORT_SYM; // No digit after sign while (my_isdigit(cs, yyGet())) ; yylval->lex_str= get_token(0, yyLength()); return(FLOAT_NUM); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c5773753a6a..b26ddcbb9e5 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5347,7 +5347,12 @@ create_like: opt_create_select: /* empty */ {} - | opt_duplicate opt_as create_select_query_expression opt_versioning_option + | opt_duplicate opt_as create_select_query_expression + opt_versioning_option + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } ; create_select_query_expression: @@ -5356,16 +5361,12 @@ create_select_query_expression: { Select->set_braces(0); Select->set_with_clause($1); - if (Lex->check_cte_dependencies_and_resolve_references()) - MYSQL_YYABORT; } union_clause | opt_with_clause SELECT_SYM create_select_part2 create_select_part3_union_not_ready create_select_part4 { Select->set_with_clause($1); - if (Lex->check_cte_dependencies_and_resolve_references()) - MYSQL_YYABORT; } | '(' create_select_query_specification ')' | '(' create_select_query_specification ')' @@ -13826,6 +13827,10 @@ delete: lex->select_lex.init_order(); } delete_part2 + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } ; opt_delete_system_time: diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 6f3cdb52840..93315add399 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -5189,7 +5189,12 @@ create_like: opt_create_select: /* empty */ {} - | opt_duplicate opt_as create_select_query_expression opt_versioning_option + | opt_duplicate opt_as create_select_query_expression + opt_versioning_option + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } ; create_select_query_expression: @@ -5198,16 +5203,12 @@ create_select_query_expression: { Select->set_braces(0); Select->set_with_clause($1); - if (Lex->check_cte_dependencies_and_resolve_references()) - MYSQL_YYABORT; } union_clause | opt_with_clause SELECT_SYM create_select_part2 create_select_part3_union_not_ready create_select_part4 { Select->set_with_clause($1); - if (Lex->check_cte_dependencies_and_resolve_references()) - MYSQL_YYABORT; } | '(' create_select_query_specification ')' | '(' create_select_query_specification ')' @@ -13780,6 +13781,10 @@ delete: lex->select_lex.init_order(); } delete_part2 + { + if (Lex->check_cte_dependencies_and_resolve_references()) + MYSQL_YYABORT; + } ; opt_delete_system_time: |