PL/Python flattens composite types to string?

From: Steve White <swhite(at)aip(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: PL/Python flattens composite types to string?
Date: 2010-01-09 10:44:35
Message-ID: 20100109104435.GA17534@cashmere.aip.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I recently wrote PL/Python code that worked on fields of composite types.

The plpy.execute() command on a SELECT returns a list of nice dictionaries
keyed on field names, containing the fields. For numeric types, the type
of the dictionary values are as expected. To my chagrin however, if a
field contains a composite type, it is flattened to a string.

I would have expected a composite type field to be returned as a dictionary
of values of the proper types, keyed on the names of the elements of the
composite type.

I was able to work around this problem in an ugly way, but I can imaging
cases where this would render plpy unsuitable.

I see nothing in the documentation about this
http://www.postgresql.org/docs/8.4/static/plpython.html
It only talks about passing composite types into and out of functions.

Is this a bug? This is psql v. 8.1.18 on one machine, and 8.4.1 on another.

Am I somehow doing it wrong?
-- See attached test

Cheers!

--
| - - - - - - - - - - - - - - - - - - - - - - - - -
| Steve White +49(331)7499-202
| e-Science / AstroGrid-D Zi. 35 Bg. 20
| - - - - - - - - - - - - - - - - - - - - - - - - -
| Astrophysikalisches Institut Potsdam (AIP)
| An der Sternwarte 16, D-14482 Potsdam
|
| Vorstand: Prof. Dr. Matthias Steinmetz, Peter A. Stolz
|
| Stiftung privaten Rechts, Stiftungsverzeichnis Brandenburg: III/7-71-026
| - - - - - - - - - - - - - - - - - - - - - - - - -

Attachment Content-Type Size
pycomptype.sql text/plain 1.2 KB

Browse pgsql-general by date

  From Date Subject
Next Message José María Terry Jiménez 2010-01-09 11:09:28 Re: pgadmin save password
Previous Message Anisha Kaul 2010-01-09 09:58:58 pgsql2shp usage