Re: getting domain information from query results

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: getting domain information from query results
Дата
Msg-id 20140109115108.GB4328@hermes.hilbert.loc
обсуждение исходный текст
Ответ на getting domain information from query results  (Marco Baringer <mb@bese.it>)
Список pgsql-general
On Thu, Jan 09, 2014 at 12:10:34PM +0100, Marco Baringer wrote:

> assuming i have this schema:
>
>   create domain almost_a_string AS text;
>   create table object ( name_like_thing almost_a_string );
>
> and i'm trying to go from the results, using postgresql's
> frontend/backend protocol, of this query:
>
>   select name_like_thing from object;
>
> to the domain of the column name_like_thing, almost_a_string.
>
> it seems, if my understanding of the protocol is correct, that the oid
> of the underlying type, text in this case, is returned and not the oid
> of the domain. i could get at the domain with an extra query, since the
> originating table/viem and column of each field in the result row is
> included, but i'd really rather have to make that extra query. is there
> something obvious that i'm missing?
>
> finally, i don't think i'm the first person to want to look at things
> this way; both psql's \d command and the function pg_typeof return
> almost_a_string (the domain) and not text (the type).

Maybe this

    http://svana.org/~kleptog/pgsql/taggedtypes.html

gives some ideas.

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


В списке pgsql-general по дате отправления:

Предыдущее
От: Marco Baringer
Дата:
Сообщение: getting domain information from query results
Следующее
От: Sameer Kumar
Дата:
Сообщение: Re: argument of CASE/WHEN must not return a set