diff --git a/changes/issue-5319-json-arrayagg b/changes/issue-5319-json-arrayagg new file mode 100644 index 0000000000..eec36a0670 --- /dev/null +++ b/changes/issue-5319-json-arrayagg @@ -0,0 +1,2 @@ +* Remove usage of JSON_ARRAYAGG in sql queries. Not supported in MySQL < 5.7.22 and + AWS RDS Aurora used in Terraform. diff --git a/server/datastore/mysql/hosts.go b/server/datastore/mysql/hosts.go index bde61e5000..8a00060907 100644 --- a/server/datastore/mysql/hosts.go +++ b/server/datastore/mysql/hosts.go @@ -1672,13 +1672,13 @@ SELECT team_id id, 'os_versions' type, COALESCE( - JSON_ARRAYAGG( + CONCAT('[', GROUP_CONCAT( JSON_OBJECT( 'hosts_count', hosts_count, 'name', name, 'platform', platform ) - ), + ), ']'), JSON_ARRAY() ) json_value FROM