mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 22:12:30 +01:00
ec537a1ad1
Don't call member functions for a NIL pointer. mysql-test/r/subselect4.result: Add test case. mysql-test/t/subselect4.test: Add test case. sql/sql_select.cc: If the (virtual) member function clone_item() returns NULL, there is no substitution to be made, and we don't need to set the collation. The test was invoking Item_cache::clone_item()
86 lines
2.4 KiB
Text
86 lines
2.4 KiB
Text
#
|
|
# Bug #46791: Assertion failed:(table->key_read==0),function unknown
|
|
# function,file sql_base.cc
|
|
#
|
|
CREATE TABLE t1 (a INT, b INT, KEY(a));
|
|
INSERT INTO t1 VALUES (1,1),(2,2);
|
|
CREATE TABLE t2 LIKE t1;
|
|
INSERT INTO t2 VALUES (1,1),(2,2);
|
|
CREATE TABLE t3 LIKE t1;
|
|
# should have 1 impossible where and 2 dependent subqueries
|
|
EXPLAIN
|
|
SELECT 1 FROM t1
|
|
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
|
|
ORDER BY count(*);
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 PRIMARY t1 index NULL a 5 NULL 2 Using index; Using temporary
|
|
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
|
|
3 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
|
|
# should not crash the next statement
|
|
SELECT 1 FROM t1
|
|
WHERE NOT EXISTS (SELECT 1 FROM t2 WHERE 1 = (SELECT MIN(t2.b) FROM t3))
|
|
ORDER BY count(*);
|
|
1
|
|
1
|
|
# should not crash: the crash is caused by the previous statement
|
|
SELECT 1;
|
|
1
|
|
1
|
|
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.
|
|
#
|
|
# Bug#53236 Segfault in DTCollation::set(DTCollation&)
|
|
#
|
|
CREATE TABLE t1 (
|
|
pk INTEGER AUTO_INCREMENT,
|
|
col_varchar VARCHAR(1),
|
|
PRIMARY KEY (pk)
|
|
)
|
|
;
|
|
INSERT INTO t1 (col_varchar)
|
|
VALUES
|
|
('w'),
|
|
('m')
|
|
;
|
|
SELECT table1.pk
|
|
FROM ( t1 AS table1 JOIN t1 AS table2 ON (table1.col_varchar =
|
|
table2.col_varchar) )
|
|
WHERE ( 1, 2 ) IN ( SELECT SUBQUERY1_t1.pk AS SUBQUERY1_field1,
|
|
SUBQUERY1_t1.pk AS SUBQUERY1_field2
|
|
FROM ( t1 AS SUBQUERY1_t1 JOIN t1 AS SUBQUERY1_t2
|
|
ON (SUBQUERY1_t2.col_varchar =
|
|
SUBQUERY1_t1.col_varchar) ) )
|
|
;
|
|
pk
|
|
drop table t1;
|