export const coalesceRowsToArray = ( source , filter ) => { return `
COALESCE(
  (
    SELECT
      array_agg(row_to_json(${ source })) FILTER (WHERE ${ filter })
    FROM
      ${ source }
  ),
  '{}'
) AS ${ source }` ; } ;