1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-25346: JSON_TABLE: Server crashes in Item_field::fix_outer_field ...

mysql_derived_prepare() sets Name_resolution_context::outer_context=NULL
for the WHERE clause's context.
Do the same for all ON expressions, too.
This commit is contained in:
Sergei Petrunia
2021-04-09 00:37:57 +03:00
committed by Alexey Botchkov
parent bd1d6ee4b1
commit 90629aa83c
3 changed files with 43 additions and 0 deletions

View File

@@ -704,6 +704,17 @@ RIGHT JOIN JSON_TABLE('[]', '$' COLUMNS(o3 FOR ORDINALITY)) AS jt3
ON(1)
WHERE 0;
ERROR 42S22: Unknown column 'jt1.a' in 'JSON_TABLE argument'
#
# MDEV-25346: JSON_TABLE: Server crashes in Item_field::fix_outer_field upon subquery with unknown column
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
SELECT * FROM ( SELECT * FROM t1 JOIN t2 ON (b IN(SELECT x FROM (SELECT 1 AS c) AS sq1))) AS sq2;
ERROR 42S22: Unknown column 'x' in 'field list'
DROP TABLE t1, t2;
#
# Another testcase
#
create table t1 (item_name varchar(32), item_props varchar(1024));
insert into t1 values ('Jeans', '{"color": ["green", "brown"], "price": 50}');
insert into t1 values ('Shirt', '{"color": ["blue", "white"], "price": 20}');