Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
10.2.26, 10.2.31, 10.3.17, 10.3.22
-
None
Description
With 10.2 and 10.3, a subquery can't refer to columns of the outer query,
with 10.0 and 10.4 the same query works fine.
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t2;
|
|
CREATE TABLE t1(id1 INT PRIMARY KEY);
|
CREATE TABLE t2(id2 INT PRIMARY KEY);
|
|
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
INSERT INTO t2 VALUES (1),(3),(5);
|
|
SELECT (SELECT id1 WHERE id1 IN (SELECT id2 FROM t2)) AS result FROM t1;
|
Expected result, as seen with MariaDB 10.1.x and 10.4.7:
+--------+
|
| result |
|
+--------+
|
| 1 |
|
| NULL |
|
| 3 |
|
| NULL |
|
| 5 |
|
+--------+
|
Actual result with 10.2 and 10.3 GA versions:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE id1 IN (SELECT id2 FROM t2)) AS result FROM t1' at line 1
|