Search code examples
mysqlsqljson-arrayagg

MySQL query JSON result is cut off


When doing:

mysql -u case -p < MyQuery.sql

with the query being:

SELECT JSON_ARRAYAGG(JSON_OBJECT('field1', field1, ...)) FROM db.table

the printed output is cut off at a random point, halfway a JSON tag. But it does end with ].

Apparently my 8000+ records are too much to handle for JSON_ARRAYAGG?

How can I work around this?


Solution

  • Although it's not documented, apparently the setting group_concat_max_len also limits the size of the results of JSON_xxxAGG() functions. Increase this to allow larger results.