Accessing complex types

Michael Hipp <[email protected]> Mon, 25 Apr 2005 13:42:05 -0500
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
I'm really hoping someone can tell me I'm doing something wrong ...

I have a table that has a complex (user defined) type like this:

CREATE TYPE addr_phone AS (
    addr1 character varying(40),
    addr2 character varying(40),
    city character varying(40),
    state character(2),
    zip character(5),
    phone character(12))

Inserting and updating the table that contains such a type is no 
problem, but when I do a select, I get the complex "column" returned as 
one big string like this:

   '(a,b,c,"d ","e    ","f           ")'

Note that it looks superficially like a tuple but it isn't. I thought to 
be smart and use 'exec' to convert that to a tuple but the first three 
items aren't quoted.

I would have thought such a complex type would be returned as a list or 
a PgArray?

Anything to be done about this or am I missing something?

Thanks,
Michael



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click