From: | "Behn, Edward (EBEHN)" <EBEHN(at)arinc(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Array of composite types returned from python |
Date: | 2014-03-20 21:54:17 |
Message-ID: | 93F16B4BD93A7840AC75EB16E9494C7B1537AB79@EXANPMB2.arinc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I've endeavored to enable the return of arrays of composite types from code
written in PL/Python. It seems that this can be accomplished though a very
minor change to the code:
On line 401 in the file src/pl/plpython/plpy_typeio.c, remove the error
report "PL/Python functions cannot return type." and replace it with the
command
arg->func = PLyObject_ToComposite;
From all that I can see, this does exactly what I want. A python list of
tuples is converted to an array of composite types in SQL.
I ran the main and python regression suites for both python2 and python3
with assert enabled. The only discrepancies I got were ones that were due to
the output expecting an error. When I altered the .out files to the expected
behavior, it matched just fine.
Am I missing anything, (ie memory leak, undesirable behavior elsewhere)?
-Ed
Ed Behn / Staff Engineer / Airline and Network Services
Information Management Services
2551 Riva Road, Annapolis, MD 21401 USA
Phone: 410.266.4426 / Cell: 240.696.7443
ebehn(at)arinc(dot)com
<http://www.rockwellcollins.com/> www.rockwellcollins.com
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2014-03-21 01:28:13 | Re: QSoC proposal: Rewrite pg_dump and pg_restore |
Previous Message | Claudio Freire | 2014-03-20 21:20:51 | Re: QSoC proposal: date_trunc supporting intervals |