[Commits] d8166829977: MDEV-25352: JSON_TABLE: Inconsistent name resolution and ER_VIEW_INVALID
revision-id: d81668299770cbe7c70af0030f25ca4242af5bb6 (mariadb-10.5.2-571-gd8166829977) parent(s): 7cd264346f188cad6e781d87f379b1145000f28e author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2021-04-08 20:46:49 +0300 message: MDEV-25352: JSON_TABLE: Inconsistent name resolution and ER_VIEW_INVALID Add testcase --- mysql-test/suite/json/r/json_table.result | 19 +++++++++++++++++++ mysql-test/suite/json/t/json_table.test | 25 +++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index da4eed6150e..3910a5977a2 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -675,6 +675,25 @@ json_table(JT.d, '$' COLUMNS (d for ordinality)) as JT2 ERROR 42S22: Unknown column 'JT2.d' in 'JSON_TABLE argument' drop table t1, t2; # +# MDEV-25352: JSON_TABLE: Inconsistent name resolution and ER_VIEW_INVALID ... +# (Just the testcase) +# +CREATE TABLE t1 (a INT, b VARCHAR(8)); +INSERT INTO t1 VALUES (1,'{}'),(2,'[]'); +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (2),(3); +SELECT t1.* +FROM +t1 NATURAL JOIN t2 +RIGHT JOIN +JSON_TABLE (t1.b, '$' COLUMNS(o FOR ORDINALITY)) AS jt ON (t1.a = jt.o) +WHERE t1.a = 1; +ERROR 42S22: Unknown column 't1.b' in 'JSON_TABLE argument' +CREATE OR REPLACE VIEW v AS +SELECT t1.* FROM t1 NATURAL JOIN t2 RIGHT JOIN JSON_TABLE (t1.b, '$' COLUMNS(o FOR ORDINALITY)) AS jt ON (t1.a = jt.o) WHERE t1.a = 1; +ERROR 42S22: Unknown column 't1.b' in 'JSON_TABLE argument' +drop table t1,t2; +# # MDEV-25256: JSON_TABLE: Error ER_VIEW_INVALID upon running query via view # SELECT * FROM diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 37a88f1d1ee..f8198322d7d 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -563,6 +563,31 @@ select * from drop table t1, t2; +--echo # +--echo # MDEV-25352: JSON_TABLE: Inconsistent name resolution and ER_VIEW_INVALID ... +--echo # (Just the testcase) +--echo # + +CREATE TABLE t1 (a INT, b VARCHAR(8)); +INSERT INTO t1 VALUES (1,'{}'),(2,'[]'); + +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (2),(3); + +--error ER_BAD_FIELD_ERROR +SELECT t1.* +FROM + t1 NATURAL JOIN t2 + RIGHT JOIN + JSON_TABLE (t1.b, '$' COLUMNS(o FOR ORDINALITY)) AS jt ON (t1.a = jt.o) +WHERE t1.a = 1; + +--error ER_BAD_FIELD_ERROR +CREATE OR REPLACE VIEW v AS +SELECT t1.* FROM t1 NATURAL JOIN t2 RIGHT JOIN JSON_TABLE (t1.b, '$' COLUMNS(o FOR ORDINALITY)) AS jt ON (t1.a = jt.o) WHERE t1.a = 1; + +drop table t1,t2; + --echo # --echo # MDEV-25256: JSON_TABLE: Error ER_VIEW_INVALID upon running query via view --echo #
participants (1)
-
psergey