Commit 1e3f09f1 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-7264: Assertion `0' failed in subselect_engine::get_identifier()

Switch EXPLAIN JSON from using subselect_engine::get_identifier()
to the number from Item_subselect::unit.

Remove subselect_union_engine::get_identifier() because it was added
only for EXPLAIN JSON code.
parent 5ee1c25f
......@@ -778,3 +778,38 @@ EXPLAIN
}
}
DROP TABLE t1,t2;
#
# MDEV-7264: Assertion `0' failed in subselect_engine::get_identifier() on EXPLAIN JSON
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a <> ALL ( SELECT b FROM t2 );
EXPLAIN
{
"query_block": {
"select_id": 1,
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "(not(<in_optimizer>(t1.a,t1.a in (subquery#2))))"
},
"subqueries": [
{
"query_block": {
"select_id": 2,
"table": {
"table_name": "t2",
"access_type": "ALL",
"rows": 2,
"filtered": 100
}
}
}
]
}
}
DROP TABLE t1, t2;
......@@ -167,3 +167,15 @@ EXPLAIN FORMAT=JSON SELECT * FROM t1 AS outer_t1 WHERE a <> ALL ( SELECT a FROM
DROP TABLE t1,t2;
--echo #
--echo # MDEV-7264: Assertion `0' failed in subselect_engine::get_identifier() on EXPLAIN JSON
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a <> ALL ( SELECT b FROM t2 );
DROP TABLE t1, t2;
......@@ -898,10 +898,10 @@ void Item_subselect::print(String *str, enum_query_type query_type)
if (query_type == QT_EXPLAIN)
{
str->append("(subquery#");
if (engine)
if (unit && unit->first_select())
{
char buf[64];
ll2str(engine->get_identifier(), buf, 10, 0);
ll2str(unit->first_select()->select_number, buf, 10, 0);
str->append(buf);
}
else
......@@ -3732,10 +3732,6 @@ int subselect_union_engine::exec()
return res;
}
int subselect_union_engine::get_identifier()
{
return unit->first_select()->select_number;
}
/*
Search for at least one row satisfying select condition
......
......@@ -871,7 +871,6 @@ public:
bool is_executed() const;
bool no_rows();
virtual enum_engine_type engine_type() { return UNION_ENGINE; }
int get_identifier();
};
......
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