Re: getting composite types info from libpq - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: getting composite types info from libpq
Date
Msg-id AANLkTi=_CaRWrJRriOrL2ibg9qQAKiRtA1YToQPAzwZU@mail.gmail.com
Whole thread Raw
In response to getting composite types info from libpq  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Responses Re: getting composite types info from libpq  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List pgsql-hackers
On Wed, Dec 15, 2010 at 1:25 PM, Daniele Varrazzo
<daniele.varrazzo@gmail.com> wrote:
> Hello,
>
> when a query returns a composite type, the libpq PQftype() function
> reports the oid of the "record" type. In psycopg:
>
>    >>> cur.execute("select (1,2)")
>    >>> cur.description
>    (('row', 2249, None, -1, None, None, None),)
>
>    test=# select typname from pg_type where oid = 2249;
>     typname
>    ---------
>     record
>
> Is there a way to recursively retrieve the types for the record components?

not without talking to the server, unless you had previously pulled
pg_attribute data.

select * from pg_attribute where attrelid = 2249;

This question is more appropriate for -general, but what are you trying to do?

merlin


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Segfault related to pg_authid when running initdb from git master
Next
From: Andrew Dunstan
Date:
Subject: Re: Complier warnings on mingw gcc 4.5.0