Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.1, 11.8.8
-
Unexpected results
Description
the derived table contributes exactly one row `(47782700, 'child')`, which should first match the `LEFT JOIN` on `t2.c0 = subq0.c1`, then satisfy both downstream predicates `subq0.c0 > t3.c0` and `subq0.c1 != t0.c0`. Therefore the query must return `47782700 | root`. MariaDB instead drops that row before the downstream joins and returns an empty result.
CREATE TABLE t0(c0 VARCHAR(100) PRIMARY KEY NOT NULL);
CREATE TABLE t2(c0 VARCHAR(100) PRIMARY KEY NOT NULL);
CREATE TABLE t3(c0 BOOLEAN, c1 REAL SIGNED UNIQUE NOT NULL, PRIMARY KEY(c0, c1)) ENGINE=Aria;
INSERT INTO t0 VALUES ('root');
INSERT INTO t2 VALUES ('child');
INSERT INTO t3 VALUES (FALSE, 47782700);
CREATE TEMPORARY TABLE temp_0(t3_c1 DOUBLE NOT NULL, t2_c0 VARCHAR(100) NOT NULL);
INSERT INTO temp_0
SELECT t3.c1, t2.c0
FROM t2, t0, t3
WHERE (t0.c0 != '#^');
INSERT INTO temp_0
SELECT t3.c1, t2.c0
FROM t2, t0, t3
WHERE ((NOT ((t0.c0 != '#^') IS TRUE)) AND (t2.c0 != t0.c0));
SELECT DISTINCT AVG(subq0.c0) OVER (), t0.c0
FROM t2
LEFT JOIN (
SELECT temp_0.t3_c1 AS c0, temp_0.t2_c0 AS c1
FROM temp_0
) AS subq0
ON (t2.c0 = subq0.c1)
STRAIGHT_JOIN t3 ON (subq0.c0 > t3.c0)
STRAIGHT_JOIN t0 ON (subq0.c1 != t0.c0); – Expected correct result: 47782700 | root – actual Wrong result: <empty>
Attachments
Issue Links
- relates to
-
MDEV-39867 Qualifying rows disappear when a constant derived-table column drives both filtering and window MIN
-
- Confirmed
-