Thread: questions for the patch 'Enable pl/python to return records based on multiple OUT params' during reviewing

<table border="0" cellpadding="0" cellspacing="0"><tr><td style="font: inherit;" valign="top">I created a function for
testingthe patch, but when i run following command, the function always raise an exception <br /><br />select
test_in_params('first');<br/>ERROR:  plpython: function "test_in_params" failed<br />DETAIL:  exceptions.NameError:
globalname 'first' is not defined<br /><br />here is the script of fucntion<br />create or replace function
test_in_params(firsttext)<br />   returns text<br />as $$<br />return first + 'first'<br />$$LANGUAGE plpythonu;<br
/><br/>Anyone help me   Thanks<br /></td></tr></table><br /> 
On Wed, 2008-12-17 at 19:03 -0800, Unicron wrote:
> I created a function for testing the patch, but when i run following
> command, the function always raise an exception 
> 
> select test_in_params('first');
> ERROR:  plpython: function "test_in_params" failed
> DETAIL:  exceptions.NameError: global name 'first' is not defined
> 
> here is the script of fucntion
> create or replace function test_in_params(first text)
>    returns text
> as $$
> return first + 'first'
> $$LANGUAGE plpythonu;
> 

what version of postgresql are you are you running

hannu=# create or replace function test_in_params(first text)
hannu-#    returns text
hannu-# as $$
hannu$# return first + 'first'
hannu$# $$LANGUAGE plpythonu;
CREATE FUNCTION
hannu=# select test_in_params('first');test_in_params 
----------------firstfirst
(1 row)


Support for named parameters has been in postgresql singce at least 8.2,
maybe 8.1 even.

-----------------
Hannu