pg_get_functiondef and aggregate functions - Mailing list pgsql-bugs

From Erki Eessaar
Subject pg_get_functiondef and aggregate functions
Date
Msg-id AM9PR01MB8268B43E248FE1DE03E1A970FE8C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com
Whole thread Raw
List pgsql-bugs
Hello

In my opinion it is confusing that although in terms of the system catalog an aggregate function is a function
the function pg_get_functiondef does not work in case of aggregate functions and produces an error.

The following code was tested in PostgreSQL 14.

SELECT pg_get_functiondef(oid) AS aggregate_function
FROM pg_proc
WHERE prokind='a';

ERROR:  "array_agg" is an aggregate function

The same happens in PostgreSQL 10.

SELECT pg_get_functiondef(oid) AS aggregate_function
FROM pg_proc
WHERE proisagg=TRUE;

At the same time the routine for returning information about parameters works with aggregate functions.

SELECT pg_get_function_arguments(oid) AS aggregate_function
FROM pg_proc
WHERE prokind='a';

I suggest that it should be at least mentioned in the documentation.

Best regards
Erki Eessaar

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: INFORMATION_SCHEMA.routines column routine_definition does not show the source
Next
From: Matthias van de Meent
Date:
Subject: Re: BUG #17257: (auto)vacuum hangs within lazy_scan_prune()