Обсуждение: How to list domains

Поиск
Список
Период
Сортировка

How to list domains

От
Alexander Cohen
Дата:
How can i get list of all domains available?

thanks!

--
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
(819) 432-3443


Re: How to list domains

От
Bruce Momjian
Дата:
Alexander Cohen wrote:
> How can i get list of all domains available?

Using psql, domains are listed with \dD.  They also appear in \dT.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: How to list domains

От
Alexander Cohen
Дата:
Yes, i just discovered that. Thanks! Actually im trying to display in
an app of mine a list of all types to the user. That goes fine but i
noticed that that list does not have "integer", "double precision" and
simple type names like that. I thought they would be domains. But i
guess they are not. Where can i find these types? What are they?

--
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
(819) 432-3443


On Apr 7, 2004, at 2:47 PM, Bruce Momjian wrote:

> Alexander Cohen wrote:
>> How can i get list of all domains available?
>
> Using psql, domains are listed with \dD.  They also appear in \dT.
>
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania
> 19073
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>
>


Re: How to list domains

От
Bruce Momjian
Дата:
Alexander Cohen wrote:
> Yes, i just discovered that. Thanks! Actually im trying to display in
> an app of mine a list of all types to the user. That goes fine but i
> noticed that that list does not have "integer", "double precision" and
> simple type names like that. I thought they would be domains. But i
> guess they are not. Where can i find these types? What are they?

They are SQL-standard names for our int4, float8 types.  They map
internally to those types.  I don't know a way to list separately.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: How to list domains

От
Tom Lane
Дата:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> They are SQL-standard names for our int4, float8 types.  They map
> internally to those types.  I don't know a way to list separately.

You can use format_type() to get the canonical per-spec form.  For instance

regression=# select typname, format_type(oid,-1) from pg_type where oid in (1043,23);
 typname |    format_type
---------+-------------------
 varchar | character varying
 int4    | integer
(2 rows)

I don't know of any way to get a listing of secondary aliases that the
parser will recognize (such as "int" for int4).  They're hardwired into
the grammar rather than being table entries anywhere.  Fortunately,
there are not all that many beyond the typname and the format_type forms.

            regards, tom lane