Search code examples
mysqlaggregate-functionsmysql-5.7

#1305 FUNCTION dbname.json_arrayagg does not exist


maybe I miss something. But why do this function doesn't exist?

Based on the documentation it should be: https://dev.mysql.com/doc/refman/5.7/en/group-by-functions.html

Version: 5.7.21-0ubuntu0.16.04.1

Somebody help me out pls :) This function could help me out well.


Solution

  • JSON_ARRAYAGG was introduced in MySQL 5.7.22.

    If you have a space between a function name and the parentheses (JSON_OBJECTAGG ("item", item.item_id)). MySQL, by default, does not handle the function name as a built-in function.

    You can either remove the space between then function name and the parentheses or use sql_mode IGNORE_SPACE. Easier just not to use the space.