multiline PL/Python function fails in *.sql - Mailing list pgsql-novice

From Wolfgang Rohdewald
Subject multiline PL/Python function fails in *.sql
Date
Msg-id 200312031052.52819.wolfgang@rohdewald.de
Whole thread Raw
Responses Re: multiline PL/Python function fails in *.sql
Re: multiline PL/Python function fails in *.sql
List pgsql-novice
Hi,

as the subject says -

if I do the same interactively in the interpreter, it works.
I tried plsql < x.sql and plsql -f x.sql, both fail with this code:

create function myfunc(text) RETURNS text AS
'
plpy.notice("hallo Notiz")' LANGUAGE 'plpython';

ERROR:  plpython: Unable to compile function myfunc
exceptions.SyntaxError: invalid syntax (line 2)

This works OK in x.sql:
create function myfunc(text) RETURNS text AS
'plpy.notice("hallo Notiz")' LANGUAGE 'plpython';

but multiline only works when using psql interactively.

This seems to be python specific, as this one also works
with plsql -f x.sql:

create function simple(text) returns text as
'
BEGIN
        RETURN $1 || $1 ;
END;
' LANGUAGE 'plpgsql';

BTW I am using PostgreSQL 7.3.4

--
Wolfgang

pgsql-novice by date:

Previous
From: Mester József
Date:
Subject: Tables form dbase
Next
From: Tom Lane
Date:
Subject: Re: solaris9 make failure...libpgport.a