multiline PL/Python function fails in *.sql

From: Wolfgang Rohdewald <wolfgang(at)rohdewald(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: multiline PL/Python function fails in *.sql
Date: 2003-12-03 09:52:52
Message-ID: 200312031052.52819.wolfgang@rohdewald.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2003-12-03 11:26:59 OT: Re: Environment variables SOLVED
Previous Message Mester József 2003-12-03 09:43:43 Tables form dbase