diff options
author | Alexander Barkov <bar@mariadb.com> | 2022-04-14 11:50:34 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2022-04-14 11:50:34 +0400 |
commit | 9d734cdd61e4174589031431138bed2f85472a58 (patch) | |
tree | 820e10b38bf67f9be5326d13de60b4e72c87cb35 /sql | |
parent | f130a5ea3c1cc504acecbad7615fb27c6e28dbfa (diff) | |
parent | 767d8d8335f9d45efb86c77a9efa0b42aff1eb27 (diff) | |
download | mariadb-git-9d734cdd61e4174589031431138bed2f85472a58.tar.gz |
Merge remote-tracking branch 'origin/10.2' into 10.3
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 22 | ||||
-rw-r--r-- | sql/item_subselect.cc | 7 | ||||
-rw-r--r-- | sql/sql_select.cc | 14 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 20 | ||||
-rw-r--r-- | sql/structs.h | 4 |
5 files changed, 49 insertions, 18 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index dc4ec0407db..b4bb3e7e61e 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -696,6 +696,7 @@ int ha_partition::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info) { int error; + THD *thd= ha_thd(); char name_buff[FN_REFLEN + 1], name_lc_buff[FN_REFLEN]; char *name_buffer_ptr; const char *path; @@ -714,8 +715,27 @@ int ha_partition::create(const char *name, TABLE *table_arg, my_error(ER_PARTITION_NO_TEMPORARY, MYF(0)); DBUG_RETURN(TRUE); } + /* + The following block should be removed once the table-level data directory + specification is supported by the partitioning engine (MDEV-28108). + */ + if (thd_sql_command(thd) == SQLCOM_ALTER_TABLE && create_info) + { + if (create_info->data_file_name) + { + push_warning_printf( + thd, Sql_condition::WARN_LEVEL_WARN, WARN_OPTION_IGNORED, + "<DATA DIRECTORY> table option of old schema is ignored"); + } + if (create_info->index_file_name) + { + push_warning_printf( + thd, Sql_condition::WARN_LEVEL_WARN, WARN_OPTION_IGNORED, + "<INDEX DIRECTORY> table option of old schema is ignored"); + } + } - if (get_from_handler_file(name, ha_thd()->mem_root, false)) + if (get_from_handler_file(name, thd->mem_root, false)) DBUG_RETURN(TRUE); DBUG_ASSERT(m_file_buffer); name_buffer_ptr= m_name_buffer_ptr; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index a5ad00c9bb9..88db52db13d 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -2765,6 +2765,8 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg) } where_item= and_items(thd, join_arg->conds, where_item); + + /* This is the fix_fields() call mentioned in the comment above */ if (where_item->fix_fields_if_needed(thd, 0)) DBUG_RETURN(true); // TIMOUR TODO: call optimize_cond() for the new where clause @@ -2775,7 +2777,10 @@ bool Item_in_subselect::inject_in_to_exists_cond(JOIN *join_arg) /* Attach back the list of multiple equalities to the new top-level AND. */ if (and_args && join_arg->cond_equal) { - /* The argument list of the top-level AND may change after fix fields. */ + /* + The fix_fields() call above may have changed the argument list, so + fetch it again: + */ and_args= ((Item_cond*) join_arg->conds)->argument_list(); ((Item_cond_and *) (join_arg->conds))->m_cond_equal= *join_arg->cond_equal; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 8d922ca953f..89344a4457d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3464,13 +3464,11 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields, tmp_table_param.using_outer_summary_function= tab->tmp_table_param->using_outer_summary_function; tab->join= this; - DBUG_ASSERT(tab > tab->join->join_tab || !top_join_tab_count || !tables_list); + DBUG_ASSERT(tab > tab->join->join_tab || !top_join_tab_count || + !tables_list); + tab->table= table; if (tab > join_tab) (tab - 1)->next_select= sub_select_postjoin_aggr; - if (!(tab->aggr= new (thd->mem_root) AGGR_OP(tab))) - goto err; - tab->table= table; - table->reginfo.join_tab= tab; /* if group or order on first table, sort first */ if ((group_list && simple_group) || @@ -3521,12 +3519,15 @@ JOIN::create_postjoin_aggr_table(JOIN_TAB *tab, List<Item> *table_fields, order= NULL; } } - + if (!(tab->aggr= new (thd->mem_root) AGGR_OP(tab))) + goto err; + table->reginfo.join_tab= tab; DBUG_RETURN(false); err: if (table != NULL) free_tmp_table(thd, table); + tab->table= NULL; DBUG_RETURN(true); } @@ -13187,6 +13188,7 @@ void JOIN::cleanup(bool full) if (curr_tab->aggr) { free_tmp_table(thd, curr_tab->table); + curr_tab->table= NULL; delete curr_tab->tmp_table_param; curr_tab->tmp_table_param= NULL; curr_tab->aggr= NULL; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 3770488f3f4..9a0a9f3149e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2035,6 +2035,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %type <charset> opt_collate + collate charset_name charset_or_alias charset_name_or_default @@ -7518,10 +7519,7 @@ charset_or_alias: } ; -collate: COLLATE_SYM collation_name_or_default - { - Lex->charset= $2; - } +collate: COLLATE_SYM collation_name_or_default { $$= $2; } ; opt_binary: @@ -7536,11 +7534,17 @@ binary: | BINARY charset_or_alias { bincmp_collation($2, true); } | charset_or_alias collate { - if (!my_charset_same(Lex->charset, $1)) - my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), - Lex->charset->name, $1->csname)); + if (!$2) + Lex->charset= $1; // CHARACTER SET cs COLLATE DEFAULT + else + { + if (!my_charset_same($2, $1)) + my_yyabort_error((ER_COLLATION_CHARSET_MISMATCH, MYF(0), + $2->name, $1->csname)); + Lex->charset= $2; + } } - | collate { } + | collate { Lex->charset= $1; } ; opt_bin_mod: diff --git a/sql/structs.h b/sql/structs.h index 46947b50502..c6f9fef2277 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -72,14 +72,14 @@ typedef struct st_key_part_info { /* Info about a key part */ uint offset; /* Offset in record (from 0) */ uint null_offset; /* Offset to null_bit in record */ /* Length of key part in bytes, excluding NULL flag and length bytes */ - uint16 length; + uint length; /* Number of bytes required to store the keypart value. This may be different from the "length" field as it also counts - possible NULL-flag byte (see HA_KEY_NULL_LENGTH) - possible HA_KEY_BLOB_LENGTH bytes needed to store actual value length. */ - uint16 store_length; + uint store_length; uint16 key_type; uint16 fieldnr; /* Fieldnr begins counting from 1 */ uint16 key_part_flag; /* 0 or HA_REVERSE_SORT */ |