Re: BUG #5232: plpythonu s=s.op() raises an exception

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Gardner" <dgardner(at)creatureshop(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5232: plpythonu s=s.op() raises an exception
Date: 2009-12-03 22:30:38
Message-ID: 15713.1259879438@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David Gardner" <dgardner(at)creatureshop(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Gardner 2009-12-03 22:46:31 Re: BUG #5232: plpythonu s=s.op() raises an exception
Previous Message Fredrik Palm 2009-12-03 20:58:24 Re: BUG #5229: Queing requests when not using psql