Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
Description
Currently the following query cannot be executed in MariaDB:
SELECT * FROM t1 |
WHERE t1.a IN (SELECT t.c FROM (SELECT t2.a, count(t2.b) AS c |
WHERE t2.a < t1.b GROUP BY t2.a) AS t) |
cannot be executed in MariaDB because the specification of the derived table t contains an external reference t1.b.
SQL standard considers this query as valid.
MySQL 8.0 supports such queries.
Similarly the query:
SELECT * FROM t1 |
WHERE t1.a IN (WITH t(c) AS (SELECT t2.a, count(t2.b) AS c |
WHERE t2.a < t1.b GROUP BY t2.a) |
SELECT t.c FROM t) |
cannot be executed in MariaDB while it is considered valid by SQL Standard and can be executed by MySQL 8.0.
Attachments
Issue Links
- is part of
-
MDEV-28906 MySQL 8.0 desired compatibility
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Currently the following query cannot be executed in MariaDB:
{code:sql} SELECT * FROM t1 WHERE t1.a IN (SELECT t.c FROM (SELECT t2.a, count(t2.b) as c WHERE t2.a < t1.b GROUP BY t2.a) as t) {code} cannot be executed in MariaDB because the specification of the derived table t contains an external reference t1.b. SQL standard considers this query as valid. MySQL 8.0 supports such queries. |
Currently the following query cannot be executed in MariaDB:
{code:sql} SELECT * FROM t1 WHERE t1.a IN (SELECT t.c FROM (SELECT t2.a, count(t2.b) AS c WHERE t2.a < t1.b GROUP BY t2.a) AS t) {code} cannot be executed in MariaDB because the specification of the derived table t contains an external reference t1.b. SQL standard considers this query as valid. MySQL 8.0 supports such queries. Similarly the query: {code:sql} SELECT * FROM t1 WHERE t1.a IN (WITH t(c) AS (SELECT t2.a, count(t2.b) AS c WHERE t2.a < t1.b GROUP BY t2.a) SELECT t.c FROM t) {code} cannot be executed in MariaDB while it is considered valid by SQL Standard and can be executed by MySQL 8.0. |
Summary | Support derived tables with external references | Support derived tables / CTE with external references |
NRE Projects | RM_105_CANDIDATE |
Workflow | MariaDB v3 [ 93595 ] | MariaDB v4 [ 131029 ] |
Description |
Currently the following query cannot be executed in MariaDB:
{code:sql} SELECT * FROM t1 WHERE t1.a IN (SELECT t.c FROM (SELECT t2.a, count(t2.b) AS c WHERE t2.a < t1.b GROUP BY t2.a) AS t) {code} cannot be executed in MariaDB because the specification of the derived table t contains an external reference t1.b. SQL standard considers this query as valid. MySQL 8.0 supports such queries. Similarly the query: {code:sql} SELECT * FROM t1 WHERE t1.a IN (WITH t(c) AS (SELECT t2.a, count(t2.b) AS c WHERE t2.a < t1.b GROUP BY t2.a) SELECT t.c FROM t) {code} cannot be executed in MariaDB while it is considered valid by SQL Standard and can be executed by MySQL 8.0. |
Currently the following query cannot be executed in MariaDB: {code:sql} SELECT * FROM t1 WHERE t1.a IN (SELECT t.c FROM (SELECT t2.a, count(t2.b) AS c WHERE t2.a < t1.b GROUP BY t2.a) AS t) {code} cannot be executed in MariaDB because the specification of the derived table t contains an external reference t1.b. SQL standard considers this query as valid. MySQL 8.0 supports such queries. Similarly the query: {code:sql} SELECT * FROM t1 WHERE t1.a IN (WITH t(c) AS (SELECT t2.a, count(t2.b) AS c WHERE t2.a < t1.b GROUP BY t2.a) SELECT t.c FROM t) {code} cannot be executed in MariaDB while it is considered valid by SQL Standard and can be executed by MySQL 8.0. |
Link | This issue is part of MDEV-28906 [ MDEV-28906 ] |
Assignee | Igor Babaev [ igor ] | Rex Johnston [ JIRAUSER52533 ] |
is there any update for this, or any work around, Thanks