pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stefan Weiss <spaceman@foo.at>
To: pgsql-sql@postgresql.org
Subject: Re: \df
Date: Sat, 8 May 2004 01:39:35 +0200
Message-ID: <200405080139.35083.spaceman@foo.at> (raw)
In-Reply-To: <E7E213858379814A9AE48CA6754F5ECB1E1F91@mail01.stbernard.com>
References: <E7E213858379814A9AE48CA6754F5ECB1E1F91@mail01.stbernard.com>

On Saturday, 08 May 2004 01:15, Jie Liang wrote:
> What sql statement equal to \df function_name
> I want to know the result data type for a given function within plpgsql.


Try the -E switch for pgsql:


spaceman@weyoun:~ $ psql -E
Welcome to psql 7.4.2, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

spaceman=# \df alt_to_iso

********* QUERY **********
SELECT CASE WHEN p.proretset THEN 'setof ' ELSE '' END ||
  pg_catalog.format_type(p.prorettype, NULL) as "Result data type",
  n.nspname as "Schema",
  p.proname as "Name",
  pg_catalog.oidvectortypes(p.proargtypes) as "Argument data types"
FROM pg_catalog.pg_proc p
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
WHERE p.prorettype <> 'pg_catalog.cstring'::pg_catalog.regtype
      AND p.proargtypes[0] <> 'pg_catalog.cstring'::pg_catalog.regtype
      AND NOT p.proisagg
      AND pg_catalog.pg_function_is_visible(p.oid)
      AND p.proname ~ '^alt_to_iso$'
ORDER BY 2, 3, 1, 4;
**************************

                         List of functions
 Result data type |   Schema   |    Name    |     Argument data types
------------------+------------+------------+---------------------------------------------
 void             | pg_catalog | alt_to_iso | integer, integer, cstring, ... 
(1 row)


HTH,
stefan weiss



view thread (4+ messages)  latest in thread

Message-ID: <200405080139.35083.spaceman@foo.at>
Permalink:  ../200405080139.35083.spaceman@foo.at/
Also on:    postgresql.org/message-id/200405080139.35083.spaceman@foo.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: spaceman@foo.at
  Subject: Re: \df
  In-Reply-To: <200405080139.35083.spaceman@foo.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox