Обсуждение: function parse error

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

function parse error

От
"Harry Stangel"
Дата:
When trying to run a trivial function, I get the error:

ERROR:  syntax error at or near "DEFINE"
CONTEXT:  compile of PL/pgSQL function "trivial" near line 1

I'm running postgresql v 7.4.5, language plpgsql is loaded.
Note that other user-defined functions without a DEFINE
block run fine.  The offending function:

CREATE OR REPLACE FUNCTION trivial() RETURNS TEXT AS '
    DEFINE
        x TEXT;
    BEGIN
        x := ''success'';
        RETURN x;
    END;
' LANGUAGE plpgsql;

Any help?



Re: function parse error

От
Michael Fuhr
Дата:
On Fri, Nov 05, 2004 at 07:33:51AM -0800, Harry Stangel wrote:

> CREATE OR REPLACE FUNCTION trivial() RETURNS TEXT AS '
>     DEFINE
>         x TEXT;

It's DECLARE, not DEFINE.

http://www.postgresql.org/docs/7.4/static/plpgsql-structure.html

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/