summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc3
-rw-r--r--sql/filesort_utils.cc2
-rw-r--r--sql/item.cc3
-rw-r--r--sql/item_cmpfunc.cc13
-rw-r--r--sql/item_cmpfunc.h1
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/partition_info.cc20
-rw-r--r--sql/partition_info.h1
-rw-r--r--sql/share/errmsg-utf8.txt46
-rw-r--r--sql/sql_partition.cc11
-rw-r--r--sql/sql_yacc.yy14
-rw-r--r--sql/table.cc8
12 files changed, 77 insertions, 47 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 8a7d5610dc2..873597480a2 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -987,7 +987,8 @@ static void make_sortkey(register Sort_param *param,
if (maybe_null)
*to++=1;
char *tmp_buffer= param->tmp_buffer ? param->tmp_buffer : (char*)to;
- String tmp(tmp_buffer, param->sort_length, cs);
+ String tmp(tmp_buffer, param->tmp_buffer ? param->sort_length :
+ sort_field->length, cs);
String *res= item->str_result(&tmp);
if (!res)
{
diff --git a/sql/filesort_utils.cc b/sql/filesort_utils.cc
index 1cef30b6a56..bc0fe4712b6 100644
--- a/sql/filesort_utils.cc
+++ b/sql/filesort_utils.cc
@@ -96,7 +96,7 @@ uchar **Filesort_buffer::alloc_sort_buffer(uint num_records, uint record_length)
if (m_idx_array.is_null())
{
- sort_buff_sz= num_records * (record_length + sizeof(uchar*));
+ sort_buff_sz= ((size_t)num_records) * (record_length + sizeof(uchar*));
set_if_bigger(sort_buff_sz, record_length * MERGEBUFF2);
uchar **sort_keys=
(uchar**) my_malloc(sort_buff_sz, MYF(MY_THREAD_SPECIFIC));
diff --git a/sql/item.cc b/sql/item.cc
index a99bef5d904..3b8ca94642e 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4733,7 +4733,8 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
select->having_fix_field &&
- select_ref != not_found_item && !group_by_ref)
+ select_ref != not_found_item && !group_by_ref &&
+ !ref->alias_name_used)
{
/*
Report the error if fields was found only in the SELECT item list and
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 807ce828131..1df19e75d65 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -2065,6 +2065,19 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const
}
+bool Item_func_interval::fix_fields(THD *thd, Item **ref)
+{
+ if (Item_int_func::fix_fields(thd, ref))
+ return true;
+ for (uint i= 0 ; i < row->cols(); i++)
+ {
+ if (row->element_index(i)->check_cols(1))
+ return true;
+ }
+ return false;
+}
+
+
void Item_func_interval::fix_length_and_dec()
{
uint rows= row->cols();
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 179ea10e5ef..a541282b898 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -729,6 +729,7 @@ public:
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
+ bool fix_fields(THD *, Item **);
longlong val_int();
void fix_length_and_dec();
const char *func_name() const { return "interval"; }
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 0f10d832ba6..7b017cd810a 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3670,7 +3670,7 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
}
}
str->append(STRING_WITH_LEN(" separator \'"));
- str->append(*separator);
+ str->append_for_single_quote(separator->ptr(), separator->length());
str->append(STRING_WITH_LEN("\')"));
}
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 0236f98c886..52bda560c1c 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -2747,6 +2747,24 @@ end:
DBUG_RETURN(result);
}
+
+bool partition_info::error_if_requires_values() const
+{
+ switch (part_type) {
+ case NOT_A_PARTITION:
+ case HASH_PARTITION:
+ break;
+ case RANGE_PARTITION:
+ my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "RANGE", "LESS THAN");
+ return true;
+ case LIST_PARTITION:
+ my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "LIST", "IN");
+ return true;
+ }
+ return false;
+}
+
+
/**
Fix partition data from parser.
@@ -2836,6 +2854,8 @@ bool partition_info::fix_parser_data(THD *thd)
part_elem= it++;
List_iterator<part_elem_value> list_val_it(part_elem->list_val_list);
num_elements= part_elem->list_val_list.elements;
+ if (!num_elements && error_if_requires_values())
+ DBUG_RETURN(true);
DBUG_ASSERT(part_type == RANGE_PARTITION ?
num_elements == 1U : TRUE);
for (j= 0; j < num_elements; j++)
diff --git a/sql/partition_info.h b/sql/partition_info.h
index a80295edde0..f250c5496bf 100644
--- a/sql/partition_info.h
+++ b/sql/partition_info.h
@@ -368,6 +368,7 @@ public:
bool *prune_needs_default_values,
MY_BITMAP *used_partitions);
bool has_same_partitioning(partition_info *new_part_info);
+ bool error_if_requires_values() const;
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(handler *file, HA_CREATE_INFO *info,
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index de0daf759fe..4958473c73d 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -1735,29 +1735,29 @@ ER_WRONG_AUTO_KEY 42000 S1009
ER_UNUSED_9
eng "You should never see it"
ER_NORMAL_SHUTDOWN
- cze "%s: normální ukončení\n"
- dan "%s: Normal nedlukning\n"
- nla "%s: Normaal afgesloten \n"
- eng "%s: Normal shutdown\n"
- est "%s: MariaDB lõpetas\n"
- fre "%s: Arrêt normal du serveur\n"
- ger "%s: Normal heruntergefahren\n"
- greek "%s: Φυσιολογική διαδικασία shutdown\n"
- hun "%s: Normal leallitas\n"
- ita "%s: Shutdown normale\n"
- jpn "%s: 通常シャットダウン\n"
- kor "%s: 정상적인 shutdown\n"
- nor "%s: Normal avslutning\n"
- norwegian-ny "%s: Normal nedkopling\n"
- pol "%s: Standardowe zakończenie działania\n"
- por "%s: 'Shutdown' normal\n"
- rum "%s: Terminare normala\n"
- rus "%s: Корректная остановка\n"
- serbian "%s: Normalno gašenje\n"
- slo "%s: normálne ukončenie\n"
- spa "%s: Apagado normal\n"
- swe "%s: Normal avslutning\n"
- ukr "%s: Нормальне завершення\n"
+ cze "%s: norm-Bální ukončení"
+ dan "%s: Normal nedlukning"
+ nla "%s: Normaal afgesloten"
+ eng "%s: Normal shutdown"
+ est "%s: MariaDB lõpetas"
+ fre "%s: Arrêt normal du serveur"
+ ger "%s: Normal heruntergefahren"
+ greek "%s: Φυσιολογική διαδικασία shutdown"
+ hun "%s: Normal leallitas"
+ ita "%s: Shutdown normale"
+ jpn "%s: 通常シャットダウン"
+ kor "%s: 정상적인 shutdown"
+ nor "%s: Normal avslutning"
+ norwegian-ny "%s: Normal nedkopling"
+ pol "%s: Standardowe zakończenie działania"
+ por "%s: 'Shutdown' normal"
+ rum "%s: Terminare normala"
+ rus "%s: Корректная остановка"
+ serbian "%s: Normalno gašenje"
+ slo "%s: normálne ukončenie"
+ spa "%s: Apagado normal"
+ swe "%s: Normal avslutning"
+ ukr "%s: Нормальне завершення"
ER_GOT_SIGNAL
cze "%s: přijat signal %d, končím\n"
dan "%s: Fangede signal %d. Afslutter!!\n"
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index a675d325a8b..dd1f60ec078 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4886,16 +4886,11 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
- else if (tab_part_info->part_type == RANGE_PARTITION)
- {
- my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "RANGE", "LESS THAN");
- }
else
{
- DBUG_ASSERT(tab_part_info->part_type == LIST_PARTITION);
- my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "LIST", "IN");
+ DBUG_ASSERT(tab_part_info->part_type == RANGE_PARTITION ||
+ tab_part_info->part_type == LIST_PARTITION);
+ (void) tab_part_info->error_if_requires_values();
}
goto err;
}
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 5367bfa5d27..04c11ec04ef 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5126,18 +5126,8 @@ opt_part_values:
partition_info *part_info= lex->part_info;
if (! lex->is_partition_management())
{
- if (part_info->part_type == RANGE_PARTITION)
- {
- my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "RANGE", "LESS THAN");
- MYSQL_YYABORT;
- }
- if (part_info->part_type == LIST_PARTITION)
- {
- my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
- "LIST", "IN");
- MYSQL_YYABORT;
- }
+ if (part_info->error_if_requires_values())
+ MYSQL_YYABORT;
}
else
part_info->part_type= HASH_PARTITION;
diff --git a/sql/table.cc b/sql/table.cc
index 38a64348937..4228860c612 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -6123,6 +6123,14 @@ void TABLE::create_key_part_by_field(KEY_PART_INFO *key_part_info,
might be reused.
*/
key_part_info->store_length= key_part_info->length;
+ /*
+ For BIT fields null_bit is not set to 0 even if the field is defined
+ as NOT NULL, look at Field_bit::Field_bit
+ */
+ if (!field->real_maybe_null())
+ {
+ key_part_info->null_bit= 0;
+ }
/*
The total store length of the key part is the raw length of the field +