pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michele Bendazzoli <mickymouse@mickymouse.it>
To: pgsql <pgsql-interfaces@postgresql.org>
Subject: plpythonu strange syntax error
Date: Fri, 18 Feb 2005 10:38:17 +0100
Message-ID: <1108719498.4676.14.camel@mickymouse.i.mickymouse.it> (raw)

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




view thread (9+ messages)  latest in thread

Message-ID: <1108719498.4676.14.camel@mickymouse.i.mickymouse.it>
Permalink:  ../1108719498.4676.14.camel@mickymouse.i.mickymouse.it/
Also on:    postgresql.org/message-id/1108719498.4676.14.camel@mickymouse.i.mickymouse.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: mickymouse@mickymouse.it
  Subject: Re: plpythonu strange syntax error
  In-Reply-To: <1108719498.4676.14.camel@mickymouse.i.mickymouse.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox