Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5
-
None
Description
Here is an example
create table t1(a varchar(255));
insert into t1 values ('red'), ('blue'), (NULL);
MariaDB [test]> select json_arrayagg(a) from t1;
|
+---------------------+
|
| json_arrayagg(a) |
|
+---------------------+
|
| ["red","blue",null] |
|
+---------------------+
|
1 row in set (0.002 sec)
|
So without ORDER BY clause inside JSON_ARRAYAGG we see null in the output
MariaDB [test]> select json_arrayagg(a order by a desc) from t1;
|
+----------------------------------+
|
| json_arrayagg(a order by a desc) |
|
+----------------------------------+
|
| ["red","blue",""] |
|
+----------------------------------+
|
1 row in set (0.003 sec)
|
 |
MariaDB [test]> select json_arrayagg(a order by a asc) from t1;
|
+---------------------------------+
|
| json_arrayagg(a order by a asc) |
|
+---------------------------------+
|
| ["","blue","red"] |
|
+---------------------------------+
|
1 row in set (0.002 sec)
|
With ORDER BY clause there is no more null in the result
Attachments
Issue Links
- relates to
-
MDEV-22011 DISTINCT with JSON_ARRAYAGG gives wrong results
- Closed