Show aggregate return types in psql \da output.
authorMagnus Hagander
Fri, 16 Mar 2007 08:28:01 +0000 (08:28 +0000)
committerMagnus Hagander
Fri, 16 Mar 2007 08:28:01 +0000 (08:28 +0000)
Greg Sabino Mullane

doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/describe.c

index 29037dbe20f76d2a0f1ed84041db6aceb61c0e35..644a71b79207b60d43204bf12749177974a9a190 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -875,8 +875,8 @@ testdb=>
 
         
         
-        Lists all available aggregate functions, together with the data
-        types they operate on. If 
+        Lists all available aggregate functions, together with their
+        return type and the data types they operate on. If 
         class="parameter">pattern
         is specified, only aggregates whose names match the pattern are shown.
         
index 62fde7cbe4a5a1698bf6ffd3ea8618f8e60d4981..0d6551e447aecce69d0f74e128ae9981442fe64d 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 2000-2007, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.152 2007/02/20 10:23:38 petere Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.153 2007/03/16 08:28:01 mha Exp $
  */
 #include "postgres_fe.h"
 #include "describe.h"
@@ -62,21 +62,22 @@ describeAggregates(const char *pattern, bool verbose)
    printfPQExpBuffer(&buf,
                      "SELECT n.nspname as \"%s\",\n"
                      "  p.proname AS \"%s\",\n"
+                     "  pg_catalog.format_type(p.prorettype, NULL) AS \"%s\",\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"
+                     "        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"
+                     "  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"
+                     "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"
                      "WHERE p.proisagg\n",
-                     _("Schema"), _("Name"),
+                     _("Schema"), _("Name"), _("Result data type"),
                      _("Argument data types"), _("Description"));
 
    processSQLNamePattern(pset.db, &buf, pattern, true, false,