plpgsql test function

Поиск
Список
Период
Сортировка
Искать

plpgsql test function

От:
"kurt miller" <miller_kurt_e@hotmail.com>
Дата:
This simple test function fails.

----------------------------------------------
drop function testit(text);
create function testit(text) returns text as '
DECLARE
    myval text;
BEGIN
    myval:= $1;
    return myval;
END;
' language 'plpgsql';

select testit('testing');
select testit(''testing'');
----------------------------------------------

Result:

DROP
CREATE
ERROR:  parser: parse error at or near ""
ERROR:  parser: parse error at or near "testing"

It doesn't seem like the parameter passing mechanism is working.
What am i missing?

TIA,
-km


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

Re: plpgsql test function

От:
JanWieck@t-online.de (Jan Wieck)
Дата:
kurt miller wrote:
> This simple test function fails.
> 
> ----------------------------------------------
> drop function testit(text);
> create function testit(text) returns text as '
> DECLARE
>     myval text;
> BEGIN
>     myval:= $1;
>     return myval;
> END;
> ' language 'plpgsql';
> 
> select testit('testing');
> select testit(''testing'');
> ----------------------------------------------
> 
> Result:
> 
> DROP
> CREATE
> ERROR:  parser: parse error at or near ""
> ERROR:  parser: parse error at or near "testing"
> 
> It doesn't seem like the parameter passing mechanism is working.
> What am i missing?

    All I can see is a missing whitespace after  "myval".
    The PL/pgSQL parser isn't that smart as the main one.


Jan

-- 

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #

FAQ