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;

Anyone help me   Thanks

Search Discussions

  • Hannu Krosing at Dec 18, 2008 at 10:17 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedDec 18, '08 at 3:04a
activeDec 18, '08 at 10:17p
posts2
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Unicron: 1 post Hannu Krosing: 1 post

People

Translate

site design / logo © 2021 Grokbase