Re: getting composite types info from libpq

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: getting composite types info from libpq
Date: 2010-12-15 18:56:10
Message-ID: AANLkTi=_CaRWrJRriOrL2ibg9qQAKiRtA1YToQPAzwZU@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wed, Dec 15, 2010 at 1:25 PM, Daniele Varrazzo
<daniele(dot)varrazzo(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-12-15 19:10:04 Re: Is possible to use Prepare/Execute inside a function?
Previous Message Adrian Klaver 2010-12-15 18:43:19 Re: How to restore from backup to 8.4.3 server using 9.0 dump/restore

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2010-12-15 18:59:41 Re: Complier warnings on mingw gcc 4.5.0
Previous Message Tom Lane 2010-12-15 18:51:00 Re: Segfault related to pg_authid when running initdb from git master