How to check if JSON_ARRAYAGG supported

Run the following simple query

with t1 as ( select 0 as a ) select version(), JSON_ARRAYAGG(a) as j from t1 where a > 0;

Example:

MariaDB [(none)]> with t1 as ( select 0 as a ) select version(), JSON_ARRAYAGG(a) as j from t1 where a > 0;
+-----------------+------+
| version() | j |
+-----------------+------+
| 10.5.13-MariaDB | NULL |
+-----------------+------+
1 row in set (0.002 sec)

If it doesn’t support you should get:

MariaDB [(none)]> with t1 as ( select 0 as a ) select version(), JSON_ARRAYAGG(a) as j from t1 where a > 0;
ERROR 1305 (42000): FUNCTION JSON_ARRAYAGG does not exist

 

Source: https://mariadb.com/kb/en/json_arrayagg/… Read the rest