pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedpl/python out params
3+ messages / 3 participants
[nested] [flat]
* pl/python out params
@ 2010-08-07 14:49 Imre Horvath <blemidon@gmail.com>
2010-08-07 19:07 ` Re: pl/python out params Richard Albright <ralbright@insiderscore.com>
2010-08-07 20:22 ` Re: pl/python out params Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 3+ messages in thread
From: Imre Horvath @ 2010-08-07 14:49 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pl/python out params
2010-08-07 14:49 pl/python out params Imre Horvath <blemidon@gmail.com>
@ 2010-08-07 19:07 ` Richard Albright <ralbright@insiderscore.com>
1 sibling, 0 replies; 3+ messages in thread
From: Richard Albright @ 2010-08-07 19:07 UTC (permalink / raw)
To: pgsql-sql
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 <https://www.insiderscore.com/;
Email: ralbright@insiderscore.com <mailto:ralbright@insiderscore.com>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pl/python out params
2010-08-07 14:49 pl/python out params Imre Horvath <blemidon@gmail.com>
@ 2010-08-07 20:22 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2010-08-07 20:22 UTC (permalink / raw)
To: Imre Horvath <blemidon@gmail.com>; +Cc: pgsql-sql
Imre Horvath <blemidon@gmail.com> writes:
> Is there a way to use output parameters with a pl/python fucntion?
At the moment I think plpython only supports a single OUT param.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2010-08-07 20:22 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-08-07 14:49 pl/python out params Imre Horvath <blemidon@gmail.com>
2010-08-07 19:07 ` Richard Albright <ralbright@insiderscore.com>
2010-08-07 20:22 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox