plpythonu strange syntax error - Mailing list pgsql-interfaces

From Michele Bendazzoli
Subject plpythonu strange syntax error
Date
Msg-id 1108719498.4676.14.camel@mickymouse.i.mickymouse.it
Whole thread Raw
Responses Re: plpythonu strange syntax error  (Michael Fuhr <mike@fuhr.org>)
List 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



pgsql-interfaces by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Question Regarding Procedural Function (store procedure)
Next
From: Michael Fuhr
Date:
Subject: Re: plpythonu strange syntax error