mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fixed bug #37004.
The value of JOIN::tables must be set to 0 when there is no matching min/max row.
This commit is contained in:
@ -4391,3 +4391,10 @@ SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
|
|||||||
s1
|
s1
|
||||||
a
|
a
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1(c int, KEY(c));
|
||||||
|
CREATE TABLE t2(a int, b int);
|
||||||
|
INSERT INTO t2 VALUES (1, 10), (2, NULL);
|
||||||
|
INSERT INTO t1 VALUES (1), (3);
|
||||||
|
SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
|
||||||
|
a b
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
@ -3273,3 +3273,15 @@ INSERT INTO t1 VALUES ('a');
|
|||||||
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
|
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #37004: NOT IN subquery with MAX over an empty set
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1(c int, KEY(c));
|
||||||
|
CREATE TABLE t2(a int, b int);
|
||||||
|
INSERT INTO t2 VALUES (1, 10), (2, NULL);
|
||||||
|
INSERT INTO t1 VALUES (1), (3);
|
||||||
|
|
||||||
|
SELECT * FROM t2 WHERE b NOT IN (SELECT max(t.c) FROM t1, t1 t WHERE t.c>10);
|
||||||
|
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
@ -888,6 +888,7 @@ JOIN::optimize()
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("info",("No matching min/max row"));
|
DBUG_PRINT("info",("No matching min/max row"));
|
||||||
zero_result_cause= "No matching min/max row";
|
zero_result_cause= "No matching min/max row";
|
||||||
|
tables= 0;
|
||||||
error=0;
|
error=0;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
@ -901,6 +902,7 @@ JOIN::optimize()
|
|||||||
{
|
{
|
||||||
DBUG_PRINT("info",("No matching min/max row"));
|
DBUG_PRINT("info",("No matching min/max row"));
|
||||||
zero_result_cause= "No matching min/max row";
|
zero_result_cause= "No matching min/max row";
|
||||||
|
tables= 0;
|
||||||
error=0;
|
error=0;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user