PostgreSQL does not support the MySQL GROUP_CONCAT() aggregation
function. This results in errors such as:
Error running :
SELECT DISTINCT wp_ngg_gallery.* , GROUP_CONCAT(CONCAT_WS('@@', meta_key, meta_value)) AS `extras` FROM `wp_ngg_gallery` LEFT OUTER JOIN `wp_postmeta` ON `wp_postmeta`.`post_id` = `extras_post_id` GROUP BY wp_ngg_gallery.gid ORDER BY `gid` ASC LIMIT 25
---- converted to ----
SELECT DISTINCT wp_ngg_gallery.* , GROUP_CONCAT(CONCAT_WS('@@', meta_key, meta_value)) AS extras FROM wp_ngg_gallery LEFT OUTER JOIN wp_postmeta ON wp_postmeta.post_id = extras_post_id GROUP BY wp_ngg_gallery.gid ORDER BY gid ASC LIMIT 25
----> ERROR: function group_concat(text) does not exist
LINE 1: SELECT DISTINCT wp_ngg_gallery.* , GROUP_CONCAT(CONCAT_WS('@...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
However, PostgreSQL 9.0 and later provide the STRING_AGG() aggregation
function for the same purpose. Therefore, replace calls to
GROUP_CONCAT() with STRING_AGG().
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>