Merge branch '10.5' into 10.6
This commit is contained in:
commit
addc828363
@ -105,3 +105,12 @@ EXISTS (SELECT 1 ORDER BY 1+sum(2) OVER ())
|
||||
#
|
||||
# End of 10.4 tests
|
||||
#
|
||||
#
|
||||
# MDEV-32411 Item_sum arguments incorrectly reset to temp table fields which causes crash
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL) ;
|
||||
INSERT INTO t1 VALUES (EXISTS(SELECT avg(3) OVER (ORDER BY COUNT(DISTINCT a, HEX(a)))));
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
@ -57,3 +57,14 @@ SELECT EXISTS (SELECT 1 ORDER BY 1+sum(2) OVER ());
|
||||
--echo #
|
||||
--echo # End of 10.4 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-32411 Item_sum arguments incorrectly reset to temp table fields which causes crash
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT NOT NULL) ;
|
||||
INSERT INTO t1 VALUES (EXISTS(SELECT avg(3) OVER (ORDER BY COUNT(DISTINCT a, HEX(a)))));
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
@ -546,27 +546,6 @@ void Item_sum::fix_num_length_and_dec()
|
||||
max_length=float_length(decimals);
|
||||
}
|
||||
|
||||
Item *Item_sum::get_tmp_table_item(THD *thd)
|
||||
{
|
||||
Item_sum* sum_item= (Item_sum *) copy_or_same(thd);
|
||||
if (sum_item && sum_item->result_field) // If not a const sum func
|
||||
{
|
||||
Field *result_field_tmp= sum_item->result_field;
|
||||
for (uint i=0 ; i < sum_item->arg_count ; i++)
|
||||
{
|
||||
Item *arg= sum_item->args[i];
|
||||
if (!arg->const_item())
|
||||
{
|
||||
if (arg->type() == Item::FIELD_ITEM)
|
||||
((Item_field*) arg)->field= result_field_tmp++;
|
||||
else
|
||||
sum_item->args[i]= new (thd->mem_root) Item_temptable_field(thd, result_field_tmp++);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sum_item;
|
||||
}
|
||||
|
||||
|
||||
void Item_sum::update_used_tables ()
|
||||
{
|
||||
|
@ -525,7 +525,6 @@ public:
|
||||
aggregator_clear();
|
||||
}
|
||||
virtual void make_unique() { force_copy_fields= TRUE; }
|
||||
Item *get_tmp_table_item(THD *thd) override;
|
||||
virtual Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
|
||||
Field *create_tmp_field_ex(MEM_ROOT *root, TABLE *table, Tmp_field_src *src,
|
||||
const Tmp_field_param *param) override
|
||||
|
@ -3232,10 +3232,13 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
|
||||
MyFlags));
|
||||
|
||||
DBUG_ASSERT(str != NULL);
|
||||
DBUG_ASSERT(*str != '\0');
|
||||
DBUG_ASSERT(error != 0);
|
||||
DBUG_ASSERT((MyFlags & ~(ME_BELL | ME_ERROR_LOG | ME_ERROR_LOG_ONLY |
|
||||
ME_NOTE | ME_WARNING | ME_FATAL)) == 0);
|
||||
|
||||
DBUG_ASSERT(str[strlen(str)-1] != '\n');
|
||||
|
||||
if (MyFlags & ME_NOTE)
|
||||
{
|
||||
level= Sql_condition::WARN_LEVEL_NOTE;
|
||||
|
@ -691,7 +691,6 @@ Sql_condition *Warning_info::push_warning(THD *thd,
|
||||
const char *msg)
|
||||
{
|
||||
Sql_condition *cond= NULL;
|
||||
DBUG_ASSERT(msg[strlen(msg)-1] != '\n');
|
||||
|
||||
if (! m_read_only)
|
||||
{
|
||||
@ -749,6 +748,7 @@ void push_warning(THD *thd, Sql_condition::enum_warning_level level,
|
||||
if (level == Sql_condition::WARN_LEVEL_ERROR)
|
||||
level= Sql_condition::WARN_LEVEL_WARN;
|
||||
|
||||
DBUG_ASSERT(msg[strlen(msg)-1] != '\n');
|
||||
(void) thd->raise_condition(code, NULL, level, msg);
|
||||
|
||||
/* Make sure we also count warnings pushed after calling set_ok_status(). */
|
||||
|
@ -3087,6 +3087,8 @@ err:
|
||||
}
|
||||
else if (info->errmsg != NULL)
|
||||
safe_strcpy(info->error_text, sizeof(info->error_text), info->errmsg);
|
||||
else if (info->error_text[0] == 0)
|
||||
safe_strcpy(info->error_text, sizeof(info->error_text), ER(info->error));
|
||||
|
||||
my_message(info->error, info->error_text, MYF(0));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user