[MDEV-21914] JSON_ARRAYAGG doesn't reject ORDER BY clause, but doesn't work either Created: 2020-03-11  Updated: 2020-06-04  Resolved: 2020-06-04

Status: Closed
Project: MariaDB Server
Component/s: JSON, Server
Affects Version/s: 10.5.1
Fix Version/s: 10.5.4

Type: Bug Priority: Major
Reporter: Lukas Eder Assignee: Alexey Botchkov
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
Relates
relates to MDEV-16620 Add support for JSON_ARRAYAGG and JSO... Closed

 Description   

The following query looks correct according to a standard SQL understanding of JSON_ARRAYAGG():

select json_arrayagg(a order by a asc)
from (select 1 a union select 2 a) t

It doesn't get rejected by MariaDB 10.5.1's parser, but produces the wrong result

[2,2]

If this is not supported (it isn't according to the docs: https://mariadb.com/kb/en/json_arrayagg), then I would have expected a syntax error, instead of a wrong result.



 Comments   
Comment by Alexey Botchkov [ 2020-06-04 ]

Why it should work BTW :\
Fixing the ORDER BY to work properly here.

Comment by Alexey Botchkov [ 2020-06-04 ]

https://github.com/MariaDB/server/commit/74198384e140bfffb2cbf139ec02e4c91747fab8

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