Commit 78683672 authored by Sergey Petrunya's avatar Sergey Petrunya

Merge 5.3 -> 5.5

parents 599a1384 763af1a8
......@@ -2783,6 +2783,16 @@ a b
deallocate prepare stmt;
drop table t1,t2;
#
# MDEV-4335: Unexpected results when selecting on information_schema
#
CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
INSERT INTO t1 VALUES ('mysql'),('information_schema');
SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
db
mysql
information_schema
DROP TABLE t1;
#
# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
#
CREATE TABLE t1 (
......
......@@ -2797,6 +2797,16 @@ a b
deallocate prepare stmt;
drop table t1,t2;
#
# MDEV-4335: Unexpected results when selecting on information_schema
#
CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
INSERT INTO t1 VALUES ('mysql'),('information_schema');
SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
db
information_schema
mysql
DROP TABLE t1;
#
# MySQL Bug#13340270: assertion table->sort.record_pointers == __null
#
CREATE TABLE t1 (
......
......@@ -2481,6 +2481,15 @@ execute stmt;
deallocate prepare stmt;
drop table t1,t2;
--echo #
--echo # MDEV-4335: Unexpected results when selecting on information_schema
--echo #
CREATE TABLE t1 (db VARCHAR(64) DEFAULT NULL);
INSERT INTO t1 VALUES ('mysql'),('information_schema');
SELECT * FROM t1 WHERE db IN (SELECT `SCHEMA_NAME` FROM information_schema.SCHEMATA);
DROP TABLE t1;
--echo #
--echo # MySQL Bug#13340270: assertion table->sort.record_pointers == __null
--echo #
......
......@@ -1996,7 +1996,7 @@ int QUICK_ROR_INTERSECT_SELECT::init()
1 error
*/
int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
{
handler *save_file= file, *org_file;
my_bool org_key_read;
......@@ -2024,7 +2024,7 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
DBUG_RETURN(0);
}
if (!(file= head->file->clone(head->s->normalized_path.str, thd->mem_root)))
if (!(file= head->file->clone(head->s->normalized_path.str, alloc)))
{
/*
Manually set the error flag. Note: there seems to be quite a few
......@@ -2125,7 +2125,8 @@ failure:
0 OK
other error code
*/
int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler,
MEM_ROOT *alloc)
{
List_iterator_fast<QUICK_SELECT_WITH_RECORD> quick_it(quick_selects);
QUICK_SELECT_WITH_RECORD *cur;
......@@ -2142,7 +2143,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
There is no use of this->file. Use it for the first of merged range
selects.
*/
int error= quick->init_ror_merged_scan(TRUE);
int error= quick->init_ror_merged_scan(TRUE, alloc);
if (error)
DBUG_RETURN(error);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
......@@ -2154,7 +2155,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
const MY_BITMAP * const save_read_set= quick->head->read_set;
const MY_BITMAP * const save_write_set= quick->head->write_set;
#endif
if (quick->init_ror_merged_scan(FALSE))
if (quick->init_ror_merged_scan(FALSE, alloc))
DBUG_RETURN(1);
quick->file->extra(HA_EXTRA_KEYREAD_PRESERVE_FIELDS);
......@@ -2188,7 +2189,7 @@ int QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan(bool reuse_handler)
int QUICK_ROR_INTERSECT_SELECT::reset()
{
DBUG_ENTER("QUICK_ROR_INTERSECT_SELECT::reset");
if (!scans_inited && init_ror_merged_scan(TRUE))
if (!scans_inited && init_ror_merged_scan(TRUE, &alloc))
DBUG_RETURN(1);
scans_inited= TRUE;
List_iterator_fast<QUICK_SELECT_WITH_RECORD> it(quick_selects);
......@@ -2324,7 +2325,7 @@ int QUICK_ROR_UNION_SELECT::reset()
List_iterator_fast<QUICK_SELECT_I> it(quick_selects);
while ((quick= it++))
{
if (quick->init_ror_merged_scan(FALSE))
if (quick->init_ror_merged_scan(FALSE, &alloc))
DBUG_RETURN(1);
}
scans_inited= TRUE;
......
......@@ -323,7 +323,7 @@ public:
0 Ok
other Error
*/
virtual int init_ror_merged_scan(bool reuse_handler)
virtual int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc)
{ DBUG_ASSERT(0); return 1; }
/*
......@@ -473,7 +473,7 @@ public:
uchar *cur_prefix);
bool reverse_sorted() { return 0; }
bool unique_key_range();
int init_ror_merged_scan(bool reuse_handler);
int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
void save_last_pos()
{ file->position(record); }
int get_type() { return QS_TYPE_RANGE; }
......@@ -722,7 +722,7 @@ public:
#ifndef DBUG_OFF
void dbug_dump(int indent, bool verbose);
#endif
int init_ror_merged_scan(bool reuse_handler);
int init_ror_merged_scan(bool reuse_handler, MEM_ROOT *alloc);
bool push_quick_back(MEM_ROOT *alloc, QUICK_RANGE_SELECT *quick_sel_range);
class QUICK_SELECT_WITH_RECORD : public Sql_alloc
......
......@@ -1509,6 +1509,9 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred)
*/
parent_lex->leaf_tables.concat(&subq_lex->leaf_tables);
if (subq_lex->options & OPTION_SCHEMA_TABLE)
parent_lex->options |= OPTION_SCHEMA_TABLE;
/*
Same as above for next_local chain
(a theory: a next_local chain always starts with ::leaf_tables
......@@ -1725,6 +1728,9 @@ static bool convert_subq_to_jtbm(JOIN *parent_join,
*/
parent_lex->leaf_tables.push_back(jtbm);
if (subq_pred->unit->first_select()->options & OPTION_SCHEMA_TABLE)
parent_lex->options |= OPTION_SCHEMA_TABLE;
/*
Same as above for TABLE_LIST::next_local chain
(a theory: a next_local chain always starts with ::leaf_tables
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment