Thread: Information about the type of elements in an array from libpq

Information about the type of elements in an array from libpq

From
Markus Bertheau
Date:
В Пнд, 02.08.2004, в 14:49, Federico Di Gregorio пишет:
> On lun, 2004-08-02 at 14:30 +0200, Markus Bertheau wrote:
> > Hi,
> >
> > I wonder if there is some kind of support for PostgreSQL's arrays in
> > psycopg? The fetch routines return the literal array syntax of
> > PostgreSQL. I'd want the fetch routines to return a list for
> > PostgreSQL's arrays, with the common types (text, int, timestamp)
> > handled like they are everywhere else in psycopg.
>
> if someone provides me with a foolprof way to extract type information
> from arrays i'll implement it. :/

It seems to me that for TEXT[] PQftype() returns 1009, and 1009 is hard
coded to be array of text, as I understand it (see also pg_type.typelem,
which is 25, the oid for text). Similarly for the other types. Wouldn't
that information be enough?

Thanks

--
Markus Bertheau <twanger@bluetwanger.de>