Thread: \df

\df

From
"Jie Liang"
Date:
Hi,
What sql statement equal to \df function_name
I want to know the result data type for a given function within plpgsql.


Thanks.

Jie Liang


Re: \df

From
Yasir Malik
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jie,
Start psql with the -E option.  Whenever you type in a command, you will
see the query that was executed.

Yasir

On Fri, 7 May 2004, Jie Liang wrote:

> Date: Fri, 7 May 2004 16:15:52 -0700
> From: Jie Liang <jie@stbernard.com>
> To: pgsql-sql@postgresql.org
> Subject: [SQL] \df
>
> Hi,
> What sql statement equal to \df function_name
> I want to know the result data type for a given function within plpgsql.
>
>
> Thanks.
>
> Jie Liang
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (NetBSD)

iQEVAwUBQJwb+uJ7vYSSIbWdAQLw1wf/U9NQI0hsV6nFN6xkst2XNXsd+PBtsCtn
ze7lNDEiBAz9NiV6jP17KGSfpIrhJLqmPV3YaFTogqjlmF9UPO2w6XWU0626clGd
FDVb4kXpExkowY+Sakbim39JSnl1WIQyCGAyOoVl0rpQpevjdA4SIXAeYJed8G1t
D47Ox5iC5u5VlDMMGgoGu6wzdx1D+pofVY3pCZZpx5vLWEfirWLNr0Fl2pWV25d7
0TerG1rq85DiccIXXNs+iuZ9ZFf8XdnCZiQ3V/vfayubk50R6vSHNHRe2MftkML2
IEdD66AE+N2hwS/L2YDhv9Npw3K5uJhLUoHgSVmtEcQaYKZrV7gjeA==
=PUhY
-----END PGP SIGNATURE-----


Re: \df

From
Stefan Weiss
Date:
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 functionsResult data type |   Schema   |    Name    |     Argument data types
------------------+------------+------------+---------------------------------------------void             | pg_catalog
|alt_to_iso | integer, integer, cstring, ... 
 
(1 row)


HTH,
stefan weiss


Re: \df

From
"Jie Liang"
Date:
Thanks.

Jie Liang

-----Original Message-----
From: Stefan Weiss [mailto:spaceman@foo.at]
Sent: Friday, May 07, 2004 4:40 PM
To: pgsql-sql@postgresql.org
Subject: Re: [SQL] \df


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 functionsResult data type |   Schema   |    Name    |     Argument data types
------------------+------------+------------+---------------------------
------------------+------------+------------+------------------void             | pg_catalog | alt_to_iso | integer,
integer,cstring, 
...
(1 row)


HTH,
stefan weiss

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org