Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.6.11, 10.6, 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2, 11.3(EOL), 11.4
Description
CREATE TEMPORARY TABLE t1 (t1_id int, t1_json text); |
INSERT t1 VALUES (1, '[[10,20]]'), (2, '[[100,200]]'), (3, '[[1000,2000]]'); |
 |
SELECT
|
t1_id,
|
t2_json,
|
(SELECT SUM(x2)
|
FROM
|
JSON_TABLE(t2_json, '$[*]' COLUMNS ( x2 int PATH '$' )) t3 |
) t2_json_sum
|
FROM
|
t1
|
CROSS JOIN
|
JSON_TABLE(t1_json, '$[*]' COLUMNS (t2_json json PATH '$' )) t2; |
Gives the result:
+-------+-------------+-------------+
|
| t1_id | t2_json | t2_json_sum |
|
+-------+-------------+-------------+
|
| 1 | [10,20] | 30 | |
| 2 | [100,200] | 30 | |
| 3 | [1000,2000] | 30 | |
+-------+-------------+-------------+
|
|
In the subquery the t2_json column from first row is used on every row.
Attachments
Issue Links
- is duplicated by
-
MDEV-34284 Wrong result when using JSON_TABLE in correlated subquery
- Closed
-
MDEV-34651 Subquery gives wrong results: using JSON_TABLE in SELECT part
- Closed
- links to