mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-24230 subquery on information_schema fails with error message
disable thd->count_cuted_fields when populating internal temporary tables for I_S, because this is how SELECT works standalone. And if the SELECT is a part of INSERT or UPDATE or RETURN or SET or anything else that enables thd->count_cuted_fields, this counting should only apply when storing the result of the SELECT in a field or a variable, not when populating internal temporary tables for I_S.
This commit is contained in:
@ -2202,8 +2202,6 @@ SCHEMA_NAME
|
|||||||
# End of 10.1 tests
|
# End of 10.1 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Start of 10.2 Test
|
|
||||||
#
|
|
||||||
# MDEV-14836: Assertion `m_status == DA_ERROR' failed in
|
# MDEV-14836: Assertion `m_status == DA_ERROR' failed in
|
||||||
# Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
|
# Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
|
||||||
#
|
#
|
||||||
@ -2276,5 +2274,12 @@ TABLE_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE CONSTRAINT_CATALOG CONSTRAI
|
|||||||
test t a `i` > 0 def test
|
test t a `i` > 0 def test
|
||||||
drop table t;
|
drop table t;
|
||||||
#
|
#
|
||||||
|
# MDEV-24230 subquery on information_schema fails with error message
|
||||||
|
#
|
||||||
|
create table t1 (n int);
|
||||||
|
create table t2 (n int);
|
||||||
|
insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2');
|
||||||
|
drop table t1, t2;
|
||||||
|
#
|
||||||
# End of 10.3 tests
|
# End of 10.3 tests
|
||||||
#
|
#
|
||||||
|
@ -1925,8 +1925,6 @@ SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a'
|
|||||||
--echo # End of 10.1 tests
|
--echo # End of 10.1 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
--echo #
|
|
||||||
--echo # Start of 10.2 Test
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-14836: Assertion `m_status == DA_ERROR' failed in
|
--echo # MDEV-14836: Assertion `m_status == DA_ERROR' failed in
|
||||||
--echo # Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
|
--echo # Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
|
||||||
@ -2000,6 +1998,14 @@ from information_schema.TABLE_CONSTRAINTS tc
|
|||||||
|
|
||||||
drop table t;
|
drop table t;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-24230 subquery on information_schema fails with error message
|
||||||
|
--echo #
|
||||||
|
create table t1 (n int);
|
||||||
|
create table t2 (n int);
|
||||||
|
insert into t1 set n = (select table_rows from information_schema.tables where table_name='t2');
|
||||||
|
drop table t1, t2;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.3 tests
|
--echo # End of 10.3 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -3695,7 +3695,6 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||||||
char name_buffer[NAME_CHAR_LEN];
|
char name_buffer[NAME_CHAR_LEN];
|
||||||
int len;
|
int len;
|
||||||
SHOW_VAR tmp, *var;
|
SHOW_VAR tmp, *var;
|
||||||
Check_level_instant_set check_level_save(thd, CHECK_FIELD_IGNORE);
|
|
||||||
bool res= FALSE;
|
bool res= FALSE;
|
||||||
CHARSET_INFO *charset= system_charset_info;
|
CHARSET_INFO *charset= system_charset_info;
|
||||||
DBUG_ENTER("show_status_array");
|
DBUG_ENTER("show_status_array");
|
||||||
@ -8669,13 +8668,6 @@ static int optimize_schema_tables_memory_usage(TABLE_LIST *table_list)
|
|||||||
DBUG_ASSERT(table->s->keys == 0);
|
DBUG_ASSERT(table->s->keys == 0);
|
||||||
DBUG_ASSERT(table->s->uniques == 0);
|
DBUG_ASSERT(table->s->uniques == 0);
|
||||||
|
|
||||||
// XXX HACK HACK HACK: in a stored function, RETURN (SELECT ...)
|
|
||||||
// enables warnings (in THD::sp_eval_expr) for the whole val_xxx/store pair,
|
|
||||||
// while the intention is to warn only for store(). Until this is
|
|
||||||
// fixed let's avoid data truncation warnings in I_S->fill_table()
|
|
||||||
if (thd->count_cuted_fields == CHECK_FIELD_IGNORE)
|
|
||||||
{
|
|
||||||
|
|
||||||
uchar *cur= table->field[0]->ptr;
|
uchar *cur= table->field[0]->ptr;
|
||||||
/* first recinfo could be a NULL bitmap, not an actual Field */
|
/* first recinfo could be a NULL bitmap, not an actual Field */
|
||||||
from_recinfo= to_recinfo= p->start_recinfo + (cur != table->record[0]);
|
from_recinfo= to_recinfo= p->start_recinfo + (cur != table->record[0]);
|
||||||
@ -8709,7 +8701,6 @@ static int optimize_schema_tables_memory_usage(TABLE_LIST *table_list)
|
|||||||
to_recinfo++;
|
to_recinfo++;
|
||||||
}
|
}
|
||||||
p->recinfo= to_recinfo;
|
p->recinfo= to_recinfo;
|
||||||
} // XXX end of HACK HACK HACK
|
|
||||||
|
|
||||||
// TODO switch from Aria to Memory if all blobs were optimized away?
|
// TODO switch from Aria to Memory if all blobs were optimized away?
|
||||||
if (instantiate_tmp_table(table, p->keyinfo, p->start_recinfo, &p->recinfo,
|
if (instantiate_tmp_table(table, p->keyinfo, p->start_recinfo, &p->recinfo,
|
||||||
@ -8872,6 +8863,7 @@ bool get_schema_tables_result(JOIN *join,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Switch_to_definer_security_ctx backup_ctx(thd, table_list);
|
Switch_to_definer_security_ctx backup_ctx(thd, table_list);
|
||||||
|
Check_level_instant_set check_level_save(thd, CHECK_FIELD_IGNORE);
|
||||||
if (table_list->schema_table->fill_table(thd, table_list, cond))
|
if (table_list->schema_table->fill_table(thd, table_list, cond))
|
||||||
{
|
{
|
||||||
result= 1;
|
result= 1;
|
||||||
|
Reference in New Issue
Block a user