mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
merge
This commit is contained in:
@ -27,4 +27,35 @@ SELECT 1;
|
|||||||
1
|
1
|
||||||
1
|
1
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
#
|
||||||
|
# Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
|
||||||
|
# query
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT,
|
||||||
|
b INT,
|
||||||
|
PRIMARY KEY (a),
|
||||||
|
KEY b (b)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (1, 1), (2, 1);
|
||||||
|
CREATE TABLE t2 LIKE t1;
|
||||||
|
INSERT INTO t2 SELECT * FROM t1;
|
||||||
|
CREATE TABLE t3 LIKE t1;
|
||||||
|
INSERT INTO t3 SELECT * FROM t1;
|
||||||
|
# Should not crash.
|
||||||
|
# Should have 1 impossible where and 2 dependent subqs.
|
||||||
|
EXPLAIN
|
||||||
|
SELECT
|
||||||
|
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
|
||||||
|
FROM t3 WHERE 1 = 0 GROUP BY 1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
|
||||||
|
2 DEPENDENT SUBQUERY t1 index NULL PRIMARY 4 NULL 2 Using index
|
||||||
|
2 DEPENDENT SUBQUERY t2 index b b 5 NULL 2 Using where; Using index; Using join buffer
|
||||||
|
# should return 0 rows
|
||||||
|
SELECT
|
||||||
|
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
|
||||||
|
FROM t3 WHERE 1 = 0 GROUP BY 1;
|
||||||
|
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
|
@ -28,5 +28,37 @@ SELECT 1;
|
|||||||
|
|
||||||
DROP TABLE t1,t2,t3;
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Bug #47106: Crash / segfault on adding EXPLAIN to a non-crashing
|
||||||
|
--echo # query
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
a INT,
|
||||||
|
b INT,
|
||||||
|
PRIMARY KEY (a),
|
||||||
|
KEY b (b)
|
||||||
|
);
|
||||||
|
INSERT INTO t1 VALUES (1, 1), (2, 1);
|
||||||
|
|
||||||
|
CREATE TABLE t2 LIKE t1;
|
||||||
|
INSERT INTO t2 SELECT * FROM t1;
|
||||||
|
|
||||||
|
CREATE TABLE t3 LIKE t1;
|
||||||
|
INSERT INTO t3 SELECT * FROM t1;
|
||||||
|
|
||||||
|
--echo # Should not crash.
|
||||||
|
--echo # Should have 1 impossible where and 2 dependent subqs.
|
||||||
|
EXPLAIN
|
||||||
|
SELECT
|
||||||
|
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
|
||||||
|
FROM t3 WHERE 1 = 0 GROUP BY 1;
|
||||||
|
|
||||||
|
--echo # should return 0 rows
|
||||||
|
SELECT
|
||||||
|
(SELECT 1 FROM t1,t2 WHERE t2.b > t3.b)
|
||||||
|
FROM t3 WHERE 1 = 0 GROUP BY 1;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
@ -3308,12 +3308,12 @@ add_key_equal_fields(KEY_FIELD **key_fields, uint and_level,
|
|||||||
@retval FALSE it's something else
|
@retval FALSE it's something else
|
||||||
*/
|
*/
|
||||||
|
|
||||||
inline static bool
|
static bool
|
||||||
is_local_field (Item *field)
|
is_local_field (Item *field)
|
||||||
{
|
{
|
||||||
field= field->real_item();
|
return field->real_item()->type() == Item::FIELD_ITEM
|
||||||
return field->type() == Item::FIELD_ITEM &&
|
&& !(field->used_tables() & OUTER_REF_TABLE_BIT)
|
||||||
!((Item_field *)field)->depended_from;
|
&& !((Item_field *)field->real_item())->depended_from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user