plpythonu strange syntax error

From: Michele Bendazzoli <mickymouse(at)mickymouse(dot)it>
To: pgsql <pgsql-interfaces(at)postgresql(dot)org>
Subject: plpythonu strange syntax error
Date: 2005-02-18 09:38:17
Message-ID: 1108719498.4676.14.camel@mickymouse.i.mickymouse.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

I try to create a trivial (for testing purpouse) function with the
plpythonu language in postgresql 8.0 but when I try to utilize it the
postgres refuse to compile it for a sintax error:
'ERROR: plpython: could not compile function ''myfunc''
DETAIL: exceptions.SyntaxError: invalid syntax (line 2)'

-- Function: myfunc(text)

-- DROP FUNCTION myfunc(text);

CREATE OR REPLACE FUNCTION myfunc(text)
RETURNS text AS
$BODY$c=1
c = 2$BODY$
LANGUAGE 'plpythonu' VOLATILE;
ALTER FUNCTION myfunc(text) OWNER TO postgres;

I.e. every time I try to add a second line to myfunc (I'm not able to
write useful function made by single line of code!:) postgres give me
the previous error. In fact if I delete the second line ('c=2', the
$BODYs text is automatically created by the pgadmin III):

CREATE OR REPLACE FUNCTION myfunc(text)
RETURNS text AS
'c=1'
LANGUAGE 'plpythonu' VOLATILE;
ALTER FUNCTION myfunc(text) OWNER TO postgres;

all works as expected.

Is it my fault or there is a bug that blocks the possibility to write
function with more than one line of code?

Thanks in advance for any advice.

ciao, Michele

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Fuhr 2005-02-18 09:56:23 Re: plpythonu strange syntax error
Previous Message Bruno Wolff III 2005-02-17 17:03:46 Re: Question Regarding Procedural Function (store procedure)