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