Home > Archive > PostgreSQL Discussion > April 2006 > User-defined types









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author User-defined types
codeWarrior

2006-04-07, 1:28 pm

Anyone know of a quick and dirty query that can retrieve the various type
definitions ? I am looking to retrieve the schema-equivalent representation
of a custom (user-defined) types.



Daniel Blaisdell

2006-04-07, 1:28 pm

\dT

-Daniel

On 4/7/06, codeWarrior <gpatnude@hotmail.com> wrote:
>
> Anyone know of a quick and dirty query that can retrieve the various type
> definitions ? I am looking to retrieve the schema-equivalent
> representation
> of a custom (user-defined) types.
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: 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
>


Tom Lane

2006-04-07, 8:25 pm

"codeWarrior" <gpatnude@hotmail.com> writes:
> Anyone know of a quick and dirty query that can retrieve the various type
> definitions ? I am looking to retrieve the schema-equivalent representation
> of a custom (user-defined) types.


Invoking "pg_dump -s" is by far the most future-proof approach.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: 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

codeWarrior

2006-04-07, 8:25 pm

I figured it out....

BTW: I was thinking more along the lines of:

SELECT PT.*, PA.* FROM pg_attribute PA
JOIN pg_type PT ON PA.attrelid = PT.typrelid
JOIN pg_class PC ON PC.oid = PA.attrelid
WHERE PT.typnamespace = 2200 AND PA.attnum > 0 AND PC.relkind IN ('r', 'c',
'v');


Perhaps this should be made into a view in the information_schema.....




Regards,
Gregory P. Patnude
Vice President - Applications & Innovations Group

iDynaTECH, Inc
665 North Riverpoint Blvd
Spokane, WA 99202

(509) 343-3104 [voice]
(208) 691-6198 [cellular]
http://www.idynatech.com






"Tom Lane" <tgl@sss.pgh.pa.us> wrote in message
news:15086.1144434800@sss.pgh.pa.us...
> "codeWarrior" <gpatnude@hotmail.com> writes:
>
> Invoking "pg_dump -s" is by far the most future-proof approach.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: 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
>



Tom Lane

2006-04-07, 8:25 pm

"codeWarrior" <gpatnude@hotmail.com> writes:
> BTW: I was thinking more along the lines of:


> SELECT PT.*, PA.* FROM pg_attribute PA
> JOIN pg_type PT ON PA.attrelid = PT.typrelid
> JOIN pg_class PC ON PC.oid = PA.attrelid
> WHERE PT.typnamespace = 2200 AND PA.attnum > 0 AND PC.relkind IN ('r', 'c',
> 'v');


> Perhaps this should be made into a view in the information_schema.....


It seems like the COLUMN_UDT_USAGE view ought to handle this ...
except perhaps that COLUMN_UDT_USAGE for some reason substitutes the
underlying type if the column type is a domain. I can't see the
justification for that --- Peter, what part of the spec led you to do
it that way? There is probably more than one way to define the spec's
notion of "user-defined types" in terms of Postgres notions, but I
don't see where you got this particular definition.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: 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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com