Re: BUG #5232: plpythonu s=s.op() raises an exception - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5232: plpythonu s=s.op() raises an exception
Date
Msg-id 15713.1259879438@sss.pgh.pa.us
Whole thread Raw
In response to BUG #5232: plpythonu s=s.op() raises an exception  ("David Gardner" <dgardner@creatureshop.com>)
Responses Re: BUG #5232: plpythonu s=s.op() raises an exception  (David Gardner <dgardner@creatureshop.com>)
List pgsql-bugs
"David Gardner" <dgardner@creatureshop.com> writes:
> CREATE OR REPLACE FUNCTION pyreplace(src text,s text)
>   RETURNS text AS
> $BODY$
> try:
>     src=src.replace(s,'')
>     return src
> except Exception,e:
>     return str(e)
> $BODY$
>   LANGUAGE 'plpythonu' VOLATILE
>   COST 100;

Weird.  You seem to need both the try block and the overwrite of the
parameter to make it misbehave.  I suspect this means we're doing
something a bit wrong in setting up the python variable for the
parameter.  Unfortunately I don't know enough about python to go further
than that.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Fredrik Palm"
Date:
Subject: Re: BUG #5229: Queing requests when not using psql
Next
From: David Gardner
Date:
Subject: Re: BUG #5232: plpythonu s=s.op() raises an exception