X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD3D38BA248 for ; Fri, 18 Feb 2005 09:26:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38365-02 for ; Fri, 18 Feb 2005 09:26:11 +0000 (GMT) Received: from mickymouse.i.mickymouse.it (host70-151.pool80183.interbusiness.it [80.183.151.70]) by svr1.postgresql.org (Postfix) with ESMTP id E34BC8BA1DF for ; Fri, 18 Feb 2005 09:26:11 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by mickymouse.i.mickymouse.it (Postfix) with ESMTP id 46A8A3400088 for ; Fri, 18 Feb 2005 10:38:26 +0100 (CET) Subject: plpythonu strange syntax error From: Michele Bendazzoli To: pgsql Content-Type: text/plain Date: Fri, 18 Feb 2005 10:38:17 +0100 Message-Id: <1108719498.4676.14.camel@mickymouse.i.mickymouse.it> Mime-Version: 1.0 X-Mailer: Evolution 2.0.3 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.251 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, RCVD_IN_NJABL_DUL, RCVD_IN_SORBS_DUL X-Spam-Level: ** X-Archive-Number: 200502/64 X-Sequence-Number: 5309 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