Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5.1, 10.5
-
None
-
Win 10
Description
When JSON_ARRAYAGG is used in a view, querying that view results in missing [ and ] brackets.
create or replace view dummy as ( |
|
select json_arrayagg(json_object( |
"type", "permPeriod", |
"id", ID |
)) as JSON_DATA |
|
from TEST |
|
group by COL1 |
)
|
|
select * from dummy |
gives:
{"type": "permPeriod", "id": 7},{"type": "permPeriod", "id": 8}
|
instead of:
[{"type": "permPeriod", "id": 7},{"type": "permPeriod", "id": 8}]
|
Attachments
Issue Links
- relates to
-
MDEV-16620 Add support for JSON_ARRAYAGG and JSON_OBJECTAGG
-
- Closed
-
-
MDEV-23004 When using GROUP BY with JSON_ARRAYAGG with joint table, the square brackets are not included
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Fix Version/s | 10.5 [ 23123 ] |
Affects Version/s | 10.5 [ 23123 ] |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Assignee | Alexey Botchkov [ holyfoot ] |
Link |
This issue relates to |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
issue.field.resolutiondate | 2020-06-04 12:58:58.0 | 2020-06-04 12:58:58.596 |
Fix Version/s | 10.5.4 [ 24264 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Link |
This issue relates to |
Workflow | MariaDB v3 [ 106342 ] | MariaDB v4 [ 157514 ] |
Thanks for the report!
Reproducible on 10.5
MariaDB [test]> show create view v1;
+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| View | Create View | character_set_client | collation_connection |
+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
| v1 | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select group_concat(json_object('type','permPeriod','id',`t1`.`id`) separator ',') AS `JSON_DATA` from `t1` group by `t1`.`i`) | utf8 | utf8_general_ci |
+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
1 row in set (0.001 sec)
MariaDB [test]> select * from v1 ;
+-----------------------------------------------------------------+
| JSON_DATA |
+-----------------------------------------------------------------+
| {"type": "permPeriod", "id": 7},{"type": "permPeriod", "id": 8} |
+-----------------------------------------------------------------+
1 row in set (0.002 sec)
MariaDB [test]> SELECT json_arrayagg(json_object( "type", "permPeriod", "id", ID )) AS JSON_DATA
-> FROM t1
-> GROUP BY i ;
+-------------------------------------------------------------------+
| JSON_DATA |
+-------------------------------------------------------------------+
| [{"type": "permPeriod", "id": 7},{"type": "permPeriod", "id": 8}] |
+-------------------------------------------------------------------+
1 row in set (0.004 sec)