On Fri, Jul 1, 2011 at 9:37 AM, Ronan Dunklau <rdunklau@xxxxxxxxx> wrote: > When I execute a statement such as "Select (an_int, a_varchar) as a_record > from test, the type returned for a_record is "record" (oid 2249). > > Is the "inner type" information propagated somehow (that an_int is an integer, > and a_varchar a varchar) ? > > If so, is it easily accessible in client libraries ? I'm using psycopg2 for > python, which itself uses libpq. I don't think the information about the components of the composite type are automatically propagated to the client nor made accessible by the libpq. You may create an user-defined type representing the record you select and cast the result to it: for example if you "create type thing as (the_int integer, the_text varchar);" and then "select (an_int, a_varchar)::thing from test", postgres will pass the "thing" oid to the client, instead of the one of the generic "record". psycopg can be programmed to return a tuple/namedtuple allowing you to get the components as python values: see <http://initd.org/psycopg/docs/extras.html#composite-types-casting> for further details. -- Daniele -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general