I found that problem is caused by migration from 9.0 to 9.6.
Log in to the database using psql and run \df array_agg
. This is how it should look in 9.0:
db=# \df array_agg
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+-----------+------------------+---------------------+------
pg_catalog | array_agg | anyarray | anyelement | agg
(1 row)
and in 9.6:
db=# \df array_agg
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+-----------+------------------+---------------------+------
pg_catalog | array_agg | anyarray | anyarray | agg
pg_catalog | array_agg | anyarray | anynonarray | agg
(2 rows)
However, when I ran \df array_agg
on my server, I get:
db=> \df array_agg
Lista funkcji
Schemat | Nazwa | Typ danych wyniku | Typy danych argumentów | Typ
------------+-----------+-------------------+------------------------+-------
pg_catalog | array_agg | anyarray | anyarray | agreg
pg_catalog | array_agg | anyarray | anynonarray | agreg
public | array_agg | anyarray | anyelement | agreg
(3 rows)
As mentioned here, it can be fixed by:
DROP AGGREGATE public.array_agg(anyelement);