Array of composite types returned from python - Mailing list pgsql-hackers

From Behn, Edward (EBEHN)
Subject Array of composite types returned from python
Date
Msg-id 93F16B4BD93A7840AC75EB16E9494C7B1537AB79@EXANPMB2.arinc.com
Whole thread Raw
Responses Re: Array of composite types returned from python  (Merlin Moncure <mmoncure@gmail.com>)
Re: Array of composite types returned from python  ("Behn, Edward (EBEHN)" <EBEHN@arinc.com>)
List pgsql-hackers
<div class="WordSection1"><p class="MsoNormal">I’ve endeavored to enable the return of arrays of composite types from
codewritten in PL/Python.  It seems that this can be accomplished though a very minor change to the code:<p
class="MsoNormal"> <pclass="MsoNormal">On line 401 in the file <span style="font-family:"Courier
New"">src/pl/plpython/plpy_typeio.c</span>,remove the error report “PL/Python functions cannot return type…” and
replaceit with the command <p class="MsoNormal"><span style="font-family:"Courier New"">arg->func =
PLyObject_ToComposite;</span><pclass="MsoNormal"> <p class="MsoNormal">From all that I can see, this does exactly what
Iwant. A python list of tuples is converted to an array of composite types in SQL. <p class="MsoNormal"> <p
class="MsoNormal">Iran the main and python regression suites for both python2 and python3 with assert enabled. The only
discrepanciesI got were ones that were due to the output expecting an error. When I altered the .out files to the
expectedbehavior, it matched just fine. <p class="MsoNormal"> <p class="MsoNormal">Am I missing anything, (ie memory
leak,undesirable behavior elsewhere)? <p class="MsoNormal">             -Ed <p class="MsoNormal"> <p
class="MsoNormal"> <pclass="MsoNormal" style="margin-top:3.05pt"><img align="left" height="115" hspace="12"
src="cid:image002.png@01CF4465.6A8B1840"v:shapes="Picture_x0020_1" width="188" /><a name="AllText"></a><a
name="EName"></a><b><spanstyle="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#231F20">Ed Behn<span
style="letter-spacing:.1pt"></span></span></b><span
style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#231F20">/Staff Engineer<span
style="letter-spacing:-.4pt"></span>/ Airline and Network Services<br /><span
style="position:relative;top:.5pt;mso-text-raise:-.5pt">InformationManagement Services</span><br />2551 Riva Road,
Annapolis,MD 21401 USA<br />Phone:<span style="letter-spacing:-.35pt"> </span>410.266.4426 / Cell: 240.696.7443<br /><a
name="Email"></a>ebehn@arinc.com<br/></span><a href="http://www.rockwellcollins.com/"><span
style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#231F20;text-decoration:none">ww<span
style="letter-spacing:-.35pt">w</span>.rockwellcollins.com</span></a><span
style="font-size:10.0pt;font-family:"Verdana","sans-serif";color:#231F20"><br/><br /></span><p
class="MsoNormal"> </div>

pgsql-hackers by date:

Previous
From: Claudio Freire
Date:
Subject: Re: QSoC proposal: date_trunc supporting intervals
Next
From: Robert Haas
Date:
Subject: Re: QSoC proposal: Rewrite pg_dump and pg_restore