plpython function problem workaround

From: "Sim Zacks" <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: plpython function problem workaround
Date: 2005-03-14 12:37:00
Message-ID: d140ko$89$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I worked around the plpython problem that doesn't allow scripts created on
Windows to be run on the *nix server with the following statement.
update pg_proc set prosrc=replace(prosrc,chr(13),'') where prolang=87238
--plpythonu's oid in my setup is 87238. I don't know if that is a standard
or just on mine.

Is there a way to automate that script every time a plpythonu function is
created?
I tried writing a trigger on the pg_proc table but it wouldn't let me:
ERROR: permission denied: "pg_proc" is a system catalog
Is there a way to do this without playing with the source code?

CREATE FUNCTION fixpython() RETURNS trigger AS $$
BEGIN
IF new.prolang=87238 THEN
new.prosrc=replace(prosrc,chr(13),'');
END IF;
end
$$ LANGUAGE 'plpgsql';

CREATE TRIGGER fixpython BEFORE INSERT OR UPDATE ON pg_proc
FOR EACH ROW EXECUTE PROCEDURE fixpython();

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2005-03-14 12:39:57 Re: pg_restore: [custom archiver] could not uncompress data: incorrect data check
Previous Message Miroslav Šulc 2005-03-14 12:18:37 Re: prelimiary performance comparison pgsql vs mysql