| From: | Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee> |
|---|---|
| To: | "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | pg_get_functiondef and aggregate functions |
| Date: | 2021-11-03 15:44:50 |
| Message-ID: | AM9PR01MB8268B43E248FE1DE03E1A970FE8C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matthias van de Meent | 2021-11-03 15:45:58 | Re: BUG #17257: (auto)vacuum hangs within lazy_scan_prune() |
| Previous Message | David G. Johnston | 2021-11-03 15:21:34 | Re: INFORMATION_SCHEMA.routines column routine_definition does not show the source |