[MDEV-26134] Embedding JSON from derived tables quotes the JSON, unlike from scalar subqueries Created: 2021-07-13  Updated: 2021-07-13

Status: Open
Project: MariaDB Server
Component/s: JSON, Server
Affects Version/s: 10.5.11
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Lukas Eder Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

The following query wraps JSON from a derived table in more JSON:

select json_array(`v1`) from (select json_array(1) as `v1`) as `t`

This results in undesirable output:

["[1]"]

It doesn't happen with scalar subqueries:

select json_array((select json_array(1) as `v1`))

Or with the usual laborious workaround for such problems:

select json_array(json_merge_preserve('[]', `v1`))
from (select json_array(1) as `v1`) as `t`

Both resulting in the expected output

[[1]]

For comparison, MySQL 8.0.22 doesn't behave this way.



 Comments   
Comment by Lukas Eder [ 2021-07-13 ]

Related issue: MDEV-13701

Comment by Sergei Golubchik [ 2021-07-13 ]

may be add782a13e58 fixes it

Generated at Thu Feb 08 09:43:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.