Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id CA5D56325B0 for ; Sat, 7 Aug 2010 16:14:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 80707-07 for ; Sat, 7 Aug 2010 19:14:03 +0000 (UTC) X-Greylist: delayed 00:06:13.33299 by SQLgrey-1.7.6 Received: from mail03.insiderscore.com (mail03.insiderscore.com [72.5.31.50]) by mail.postgresql.org (Postfix) with ESMTP id 102BC632F2D for ; Sat, 7 Aug 2010 16:14:03 -0300 (ADT) Received: from [192.168.1.5] (pool-72-82-224-243.cmdnnj.fios.verizon.net [72.82.224.243]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail03.insiderscore.com (Postfix) with ESMTP id 59D731780053 for ; Sat, 7 Aug 2010 15:07:46 -0400 (EDT) X-DomainKeys: Sendmail DomainKeys Filter v1.0.1 mail03.insiderscore.com 59D731780053 DomainKey-Signature: a=rsa-sha1; s=is; d=insiderscore.com; c=simple; q=dns; b=oOGINjIAkGo7yQCI/kM4px+X6xYKzF3Xh0jCO3D8FGEqab6A4PVTfC/tEFR3yzw77 B0nqudYTepEhTeQAvNElYcNqecuHHAP6yJNLsWuOPt9XWTNlFAwsED1njf3Ht05 Message-ID: <4C5DAEFE.50106@insiderscore.com> Date: Sat, 07 Aug 2010 15:07:42 -0400 From: Richard Albright User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Lightning/1.0b1 Thunderbird/3.0.6 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: pl/python out params References: <1281192586.5038.3.camel@cytherian.blemidon.dyndns.org> In-Reply-To: <1281192586.5038.3.camel@cytherian.blemidon.dyndns.org> Content-Type: multipart/alternative; boundary="------------060907050600080605040008" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201008/35 X-Sequence-Number: 34475 This is a multi-part message in MIME format. --------------060907050600080605040008 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit first define a custom type, then drop the out parameters. create type mytype as ( i integer, j text ); create or replace function outtest() returns mytype as $BODY$ i = 1 j = 'something' return ( i, j ) $BODY$ language plpythonu; select * from outtest(); i | j ---+----------- 1 | something (1 row) On 08/07/2010 10:49 AM, Imre Horvath wrote: > Hi! > > Is there a way to use output parameters with a pl/python fucntion? > I've tried with no luck: if I define out parameters, it says return type > must be record, if I define a record return type, I get an error on > executing that pl/python doesn't support record return type... > > My simple test func is: > > create or replace function outtest(out i integer, out j text) > returns boolean as > $BODY$ > i = 1 > j = 'something' > return True > $BODY$ > language plpythonu; > > Thanks in advance: > Imre Horvath > > > -- *Rick Albright* Senior Quantitave Analyst Web: www.insiderscore.com Email: ralbright@insiderscore.com --------------060907050600080605040008 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit first define a custom type, then drop the out parameters.

create type mytype as (
i integer,
j text );

create or replace function outtest()
 returns mytype as
$BODY$
i = 1
j = 'something'
return ( i, j )
$BODY$
language plpythonu;

select * from outtest();
 i |     j    
---+-----------
 1 | something
(1 row)


On 08/07/2010 10:49 AM, Imre Horvath wrote:
Hi!

Is there a way to use output parameters with a pl/python fucntion?
I've tried with no luck: if I define out parameters, it says return type
must be record, if I define a record return type, I get an error on
executing that pl/python doesn't support record return type...

My simple test func is:

create or replace function outtest(out i integer, out j text)
 returns boolean as
$BODY$
i = 1
j = 'something'
return True
$BODY$
language plpythonu;

Thanks in advance:
Imre Horvath


  


--
Rick Albright
Senior Quantitave Analyst
Web: www.insiderscore.com
Email: ralbright@insiderscore.com
--------------060907050600080605040008--