mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Aggregate functions now support multiple input arguments. I also took
the opportunity to treat COUNT(*) as a zero-argument aggregate instead of the old hack that equated it to COUNT(1); this is materially cleaner (no more weird ANYOID cases) and ought to be at least a tiny bit faster. Original patch by Sergey Koposov; review, documentation, simple regression tests, pg_dump and psql support by moi.
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.141 2006/07/17 00:21:23 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.142 2006/07/27 19:52:06 tgl Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
#include "describe.h"
|
||||
@ -67,17 +67,22 @@ describeAggregates(const char *pattern, bool verbose)
|
||||
printfPQExpBuffer(&buf,
|
||||
"SELECT n.nspname as \"%s\",\n"
|
||||
" p.proname AS \"%s\",\n"
|
||||
" CASE p.proargtypes[0]\n"
|
||||
" WHEN 'pg_catalog.\"any\"'::pg_catalog.regtype\n"
|
||||
" THEN CAST('%s' AS pg_catalog.text)\n"
|
||||
" ELSE pg_catalog.format_type(p.proargtypes[0], NULL)\n"
|
||||
" CASE WHEN p.pronargs = 0\n"
|
||||
" THEN CAST('*' AS pg_catalog.text)\n"
|
||||
" ELSE\n"
|
||||
" pg_catalog.array_to_string(ARRAY(\n"
|
||||
" SELECT\n"
|
||||
" pg_catalog.format_type(p.proargtypes[s.i], NULL)\n"
|
||||
" FROM\n"
|
||||
" pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n"
|
||||
" ), ', ')\n"
|
||||
" END AS \"%s\",\n"
|
||||
" pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n"
|
||||
"FROM pg_catalog.pg_proc p\n"
|
||||
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
|
||||
"WHERE p.proisagg\n",
|
||||
_("Schema"), _("Name"), _("(all types)"),
|
||||
_("Data type"), _("Description"));
|
||||
_("Schema"), _("Name"),
|
||||
_("Argument data types"), _("Description"));
|
||||
|
||||
processNamePattern(&buf, pattern, true, false,
|
||||
"n.nspname", "p.proname", NULL,
|
||||
|
Reference in New Issue
Block a user