mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-25381: JSON_TABLE: ER_WRONG_OUTER_JOIN upon query with LEFT and RIGHT joins and view
Table_function_json_table::m_dep_tables attempts to cache the value of m_json->used_tables(), poorly. Remove the cache and use the value directly.
This commit is contained in:
committed by
Alexey Botchkov
parent
4a10dd0253
commit
6bac48d0cf
@@ -750,5 +750,48 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY jt ALL NULL NULL NULL NULL 40 Table function: json_table; Using where; FirstMatch(t1)
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-25381: JSON_TABLE: ER_WRONG_OUTER_JOIN upon query with LEFT and RIGHT joins and view
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE TABLE t2 (b INT, c TEXT);
|
||||
INSERT INTO t2 VALUES (1,'{}'),(2,'[]');
|
||||
CREATE VIEW v2 AS SELECT * FROM t2;
|
||||
SELECT *
|
||||
FROM
|
||||
t1 RIGHT JOIN
|
||||
t2 AS tt
|
||||
LEFT JOIN
|
||||
JSON_TABLE(tt.c, '$' COLUMNS(o FOR ORDINALITY)) AS jt
|
||||
ON tt.b = jt.o
|
||||
ON t1.a = tt.b;
|
||||
a b c o
|
||||
1 1 {} 1
|
||||
2 2 [] NULL
|
||||
SELECT *
|
||||
FROM
|
||||
t1 RIGHT JOIN
|
||||
v2 AS tt
|
||||
LEFT JOIN
|
||||
JSON_TABLE(tt.c, '$' COLUMNS(o FOR ORDINALITY)) AS jt
|
||||
ON tt.b = jt.o
|
||||
ON t1.a = tt.b;
|
||||
a b c o
|
||||
1 1 {} 1
|
||||
2 2 [] NULL
|
||||
SELECT *
|
||||
FROM
|
||||
t1 RIGHT JOIN
|
||||
v2 AS tt
|
||||
LEFT JOIN
|
||||
JSON_TABLE(CONCAT(tt.c,''), '$' COLUMNS(o FOR ORDINALITY)) AS jt
|
||||
ON tt.b = jt.o
|
||||
ON t1.a = tt.b;
|
||||
a b c o
|
||||
1 1 {} 1
|
||||
2 2 [] NULL
|
||||
DROP VIEW v2;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# End of 10.6 tests
|
||||
#
|
||||
|
Reference in New Issue
Block a user