List of User Defined Types?
List of User Defined Types?
От:
STA <iamthepants@gmail.com>
Дата:
Is there a way to bring up a list of user defined types either as a query or in the pgAdmin UI? The reason I'm asking is that I've created several types in order to return SETOF [mytype] in functions, and it would be handy to be able to view all these custom types in one place. Does such a node exist somewhere in the pgAdmin object browser? I see the Type displayed in the dependencies tab in the function properties; it would be nice if you could double-click that type and see the original CREATE TYPE statement. Thanks in advance, STA
Re: List of User Defined Types?
От:
Thom Brown <thom@linux.com>
Дата:
On 18 August 2010 04:39, STA wrote: > Is there a way to bring up a list of user defined types either as a > query or in the pgAdmin UI? > > The reason I'm asking is that I've created several types in order to > return SETOF [mytype] in functions, and it would be handy to be able > to view all these custom types in one place. Does such a node exist > somewhere in the pgAdmin object browser? I see the Type displayed in > the dependencies tab in the function properties; it would be nice if > you could double-click that type and see the original CREATE TYPE > statement. > If you're using PgAdmin, you can enable the display of user types by going to: File > Options > Display (tab) > then ticking "Types". In psql you can use \dT or \dT+ They will also be listed in pg_catalog.pg_type table. Regards -- Thom Brown Registered Linux user: #516935
Re: List of User Defined Types?
От:
Sean Anderson <iamthepants@gmail.com>
Дата:
Thom - thank you so much. This is exactly what I was looking for, and is very much appreciated.
On Wed, Aug 18, 2010 at 2:54 AM, Thom Brown <thom@linux.com> wrote:
On 18 August 2010 04:39, STA <iamthepants@gmail.com> wrote:
> Is there a way to bring up a list of user defined types either as a
> query or in the pgAdmin UI?
>
> The reason I'm asking is that I've created several types in order to
> return SETOF [mytype] in functions, and it would be handy to be able
> to view all these custom types in one place. Does such a node exist
> somewhere in the pgAdmin object browser? I see the Type displayed in
> the dependencies tab in the function properties; it would be nice if
> you could double-click that type and see the original CREATE TYPE
> statement.
>
If you're using PgAdmin, you can enable the display of user types by
going to: File > Options > Display (tab) > then ticking "Types".
In psql you can use \dT or \dT+
They will also be listed in pg_catalog.pg_type table.
Regards
--
Thom Brown
Registered Linux user: #516935
Re: List of User Defined Types?
От:
Siddharth Saha <siddharthsaha@drishti-soft.com>
Дата:
How can you determine the number of user defined types. Does the pg_type table has some entry which indicates that it is a user defined type and not a pre-defined one?
--
On Wed, Aug 18, 2010 at 8:45 PM, Sean Anderson <iamthepants@gmail.com> wrote:
Thom - thank you so much. This is exactly what I was looking for, and is very much appreciated.On Wed, Aug 18, 2010 at 2:54 AM, Thom Brown <thom@linux.com> wrote:On 18 August 2010 04:39, STA <iamthepants@gmail.com> wrote:
> Is there a way to bring up a list of user defined types either as a
> query or in the pgAdmin UI?
>
> The reason I'm asking is that I've created several types in order to
> return SETOF [mytype] in functions, and it would be handy to be able
> to view all these custom types in one place. Does such a node exist
> somewhere in the pgAdmin object browser? I see the Type displayed in
> the dependencies tab in the function properties; it would be nice if
> you could double-click that type and see the original CREATE TYPE
> statement.
>
If you're using PgAdmin, you can enable the display of user types by
going to: File > Options > Display (tab) > then ticking "Types".
In psql you can use \dT or \dT+
They will also be listed in pg_catalog.pg_type table.
Regards
--
Thom Brown
Registered Linux user: #516935
--
Thanks & Regards,
Siddharth Saha
Software Engineer | Drishti-Soft Solutions Pvt Ltd | Gurgaon, Delhi-NCR, India
Phone: +91-9711229624 | email: siddharthsaha@drishti-soft.com
Re: List of User Defined Types?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Siddharth Saha writes: > How can you determine the number of user defined types. Does the pg_type > table has some entry which indicates that it is a user defined type and not > a pre-defined one? There isn't any hard and fast distinction betweem built-in and user-defined types. Depending on what you're doing, you might want to consider a type "built-in" if it resides in the pg_catalog or information_schema schemas (I think this is the definition psql's \dT uses). Or you could check whether the type's OID is less than 16384, which would tell you whether it was created during initdb. regards, tom lane