33 *
44 * Copyright 2000 by PostgreSQL Global Development Group
55 *
6- * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.22 2000/07/07 19:24:38 petere Exp $
6+ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.23 2000/07/09 21:30:19 petere Exp $
77 */
88#include "postgres.h"
99#include "describe.h"
@@ -103,21 +103,21 @@ describeFunctions(const char *name, bool verbose)
103103 * arguments, but have no types defined for those arguments
104104 */
105105 strcpy (buf ,
106- "SELECT t.typname as \"Result\", p.proname as \"Function\",\n"
106+ "SELECT format_type(p.prorettype, NULL) as \"Result\", p.proname as \"Function\",\n"
107107 " oidvectortypes(p.proargtypes) as \"Arguments\"" );
108108 if (verbose )
109109 strcat (buf , ",\n u.usename as \"Owner\", l.lanname as \"Language\", p.prosrc as \"Source\",\n"
110110 " obj_description(p.oid) as \"Description\"" );
111111
112112 if (!verbose )
113113 strcat (buf ,
114- "\nFROM pg_proc p, pg_type t \n"
115- "WHERE p.prorettype = t.oid and (pronargs = 0 or oidvectortypes(p.proargtypes) != '')\n" );
114+ "\nFROM pg_proc p\n"
115+ "WHERE p.prorettype <> 0 and (pronargs = 0 or oidvectortypes(p.proargtypes) <> '')\n" );
116116 else
117117 strcat (buf ,
118- "\nFROM pg_proc p, pg_type t, pg_language l, pg_user u\n"
119- "WHERE p.prorettype = t.oid AND p. prolang = l.oid AND p.proowner = u.usesysid\n"
120- " AND (pronargs = 0 or oidvectortypes(p.proargtypes) != '')\n" );
118+ "\nFROM pg_proc p, pg_language l, pg_user u\n"
119+ "WHERE p.prolang = l.oid AND p.proowner = u.usesysid\n"
120+ " AND p.prorettype <> 0 and (pronargs = 0 or oidvectortypes(p.proargtypes) <> '')\n" );
121121
122122 if (name )
123123 {
@@ -380,7 +380,7 @@ objectDescription(const char *object)
380380 descbuf [0 ] = '\0' ;
381381
382382 /* Aggregate descriptions */
383- strcat (descbuf , "SELECT DISTINCT a.aggname as \"Name\", 'aggregate'::text as \"Object\", d.description as \"Description\"\n"
383+ strcat (descbuf , "SELECT DISTINCT a.aggname::text as \"Name\", 'aggregate'::text as \"Object\", d.description as \"Description\"\n"
384384 "FROM pg_aggregate a, pg_description d\n"
385385 "WHERE a.oid = d.objoid\n" );
386386 if (object )
@@ -392,7 +392,7 @@ objectDescription(const char *object)
392392
393393 /* Function descriptions (except in/outs for datatypes) */
394394 strcat (descbuf , "\nUNION ALL\n\n" );
395- strcat (descbuf , "SELECT DISTINCT p.proname as \"Name\", 'function'::text as \"Object\", d.description as \"Description\"\n"
395+ strcat (descbuf , "SELECT DISTINCT p.proname::text as \"Name\", 'function'::text as \"Object\", d.description as \"Description\"\n"
396396 "FROM pg_proc p, pg_description d\n"
397397 "WHERE p.oid = d.objoid AND (p.pronargs = 0 or oidvectortypes(p.proargtypes) != '')\n" );
398398 if (object )
@@ -404,7 +404,7 @@ objectDescription(const char *object)
404404
405405 /* Operator descriptions */
406406 strcat (descbuf , "\nUNION ALL\n\n" );
407- strcat (descbuf , "SELECT DISTINCT o.oprname as \"Name\", 'operator'::text as \"Object\", d.description as \"Description\"\n"
407+ strcat (descbuf , "SELECT DISTINCT o.oprname::text as \"Name\", 'operator'::text as \"Object\", d.description as \"Description\"\n"
408408 "FROM pg_operator o, pg_description d\n"
409409 /* must get comment via associated function */
410410 "WHERE RegprocToOid(o.oprcode) = d.objoid\n" );
@@ -429,7 +429,7 @@ objectDescription(const char *object)
429429
430430 /* Relation (tables, views, indices, sequences) descriptions */
431431 strcat (descbuf , "\nUNION ALL\n\n" );
432- strcat (descbuf , "SELECT DISTINCT c.relname as \"Name\", 'relation'::text||'('||c.relkind||')' as \"Object\", d.description as \"Description\"\n"
432+ strcat (descbuf , "SELECT DISTINCT c.relname::text as \"Name\", 'relation'::text||'('||c.relkind||')' as \"Object\", d.description as \"Description\"\n"
433433 "FROM pg_class c, pg_description d\n"
434434 "WHERE c.oid = d.objoid\n" );
435435 if (object )
@@ -441,7 +441,7 @@ objectDescription(const char *object)
441441
442442 /* Rule description (ignore rules for views) */
443443 strcat (descbuf , "\nUNION ALL\n\n" );
444- strcat (descbuf , "SELECT DISTINCT r.rulename as \"Name\", 'rule'::text as \"Object\", d.description as \"Description\"\n"
444+ strcat (descbuf , "SELECT DISTINCT r.rulename::text as \"Name\", 'rule'::text as \"Object\", d.description as \"Description\"\n"
445445 "FROM pg_rewrite r, pg_description d\n"
446446 "WHERE r.oid = d.objoid AND r.rulename !~ '^_RET'\n" );
447447 if (object )
@@ -453,7 +453,7 @@ objectDescription(const char *object)
453453
454454 /* Trigger description */
455455 strcat (descbuf , "\nUNION ALL\n\n" );
456- strcat (descbuf , "SELECT DISTINCT t.tgname as \"Name\", 'trigger'::text as \"Object\", d.description as \"Description\"\n"
456+ strcat (descbuf , "SELECT DISTINCT t.tgname::text as \"Name\", 'trigger'::text as \"Object\", d.description as \"Description\"\n"
457457 "FROM pg_trigger t, pg_description d\n"
458458 "WHERE t.oid = d.objoid\n" );
459459 if (object )
0 commit comments