change brackets for array aggregation in postgres
<p>I like to change the brackets "{" and "}" to "[" and "]" in the following example. I have a table A with two coloumns, one is text_1 of type string and the second is count of type bigint. What I'm trying to do is to return a matrix notation like <code>[[1,2,4],[2,4,5],...]</code>.</p>

<pre><code>CREATE AGGREGATE array_agg_mult(anyarray) (
    SFUNC = array_cat,
    STYPE = anyarray,
    INITCOND = '{}'
);

WITH B AS(
SELECT 
    array_agg(count) AS count 
FROM
    A 
GROUP BY
    text_1
)
SELECT
    array_agg_mult(ARRAY[count]) 
FROM
    B;
</code></pre>

<p>Besides how to update array_agg_mult, if I try to change <code>INITCOND = '{}'</code> to <code>INITCOND = '[]'</code> I get the </p>

<blockquote>
  <p>ERROR:  function "array_agg_mult" already exists with same argument
  types</p>
</blockquote>

<p>Maybe there is a smart solution by using json generation with postgres.</p>