Thread: seeing type defination..

seeing type defination..

From
Rajesh Kumar Mallah
Date:


psql> CREATE TYPE mytype AS (a1 int, a2 varchar(100)) ;

is there any way to see the constitution of "mytype"
at a later date?

just like we have \d <tablename> command
is there anything for types?


regds
mallah.




-- 
Rajesh Kumar Mallah,
Project Manager (Development)
Infocom Network Limited, New Delhi
phone: +91(11)6152172 (221) (L) ,9811255597 (M)

Visit http://www.trade-india.com ,
India's Leading B2B eMarketplace.



Re: seeing type defination..

From
Tom Lane
Date:
Rajesh Kumar Mallah <mallah@trade-india.com> writes:
> psql> CREATE TYPE mytype AS (a1 int, a2 varchar(100)) ;

> is there any way to see the constitution of "mytype"
> at a later date?

regression=#  CREATE TYPE mytype AS (a1 int, a2 varchar(100)) ;
CREATE TYPE
regression=# \d mytypeComposite type "public.mytype"Column |          Type
--------+------------------------a1     | integera2     | character varying(100)

regression=#
        regards, tom lane



Re: seeing type defination..

From
Date:

Sorry it works.

actually i tried the worng things first i shud have
RTFM ;-)

by the way there is still a lacuna i cannot  exclusively list
my custom return  types within a schema , the pg_catalog
name space is always included and have typically 60 type
entries , so when i do

\dT everything is listed will it be possible in 7.4 to list types
in a schema only ?


i have reserved a namespace for holding just return types
becoz i cannot specity composites return types while declaring
functions like

CREATE FUNCTION foo (int , text ) RETURNS SETOF (int , double , text ) AS '

'  language 'blah'   ;

we need to create a return type first just for that,

would it be cool to allow the syntax above ?



regds
mallah.

tradein_clients=# \dT custom_return_types.table_desc              List of data types      Schema        |    Name    |
Description
---------------------+------------+-------------custom_return_types | table_desc |
(1 row)

tradein_clients=# \dT+ custom_return_types.table_desc                          List of data types      Schema        |
 Name    | Internal name | Size  | Description 
---------------------+------------+---------------+-------+-------------custom_return_types | table_desc | table_desc
| tuple | 
(1 row)

tradein_clients=# \d custom_return_types.table_desc
Composite type "custom_return_types.table_desc" Column  | Type
----------+------attname  | nametypeinfo | text

tradein_clients=#




> Rajesh Kumar Mallah <mallah@trade-india.com> writes:
>> psql> CREATE TYPE mytype AS (a1 int, a2 varchar(100)) ;
>
>> is there any way to see the constitution of "mytype"
>> at a later date?
>
> regression=#  CREATE TYPE mytype AS (a1 int, a2 varchar(100)) ;
> CREATE TYPE
> regression=# \d mytype
> Composite type "public.mytype"
> Column |          Type
> --------+------------------------
> a1     | integer
> a2     | character varying(100)
>
> regression=#
>
>             regards, tom lane



-----------------------------------------
Get your free web based email at trade-india.com.  "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/



Re: seeing type defination..

From
Tom Lane
Date:
<mallah@trade-india.com> writes:
> by the way there is still a lacuna i cannot  exclusively list
> my custom return  types within a schema , the pg_catalog
> name space is always included and have typically 60 type
> entries , so when i do
> \dT everything is listed will it be possible in 7.4 to list types
> in a schema only ?

\dT myschema.*
        regards, tom lane



Re: seeing type defination..

From
Date:

Oops great!

i just missed by a '.'

Thanks
Mallah.

tradein_clients=# \dT custom_return_types*    List of data typesSchema | Name | Description
--------+------+-------------
(0 rows)

tradein_clients=#



tradein_clients=# \dT custom_return_types.*                          List of data types      Schema        |
   Name                | Description 
---------------------+------------------------------------+-------------custom_return_types |
custom_return_types.login_response|custom_return_types | custom_return_types.table_desc     | 
(2 rows)


> <mallah@trade-india.com> writes:
>> by the way there is still a lacuna i cannot  exclusively list
>> my custom return  types within a schema , the pg_catalog
>> name space is always included and have typically 60 type
>> entries , so when i do
>> \dT everything is listed will it be possible in 7.4 to list types in a schema only ?
>
> \dT myschema.*
>
>             regards, tom lane



-----------------------------------------
Get your free web based email at trade-india.com.  "India's Leading B2B eMarketplace.!"
http://www.trade-india.com/