plpython function problem workaround
| От | Sim Zacks |
|---|---|
| Тема | plpython function problem workaround |
| Дата | |
| Msg-id | d140ko$89$1@news.hub.org обсуждение исходный текст |
| Ответы |
Re: plpython function problem workaround
|
| Список | 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();
В списке pgsql-general по дате отправления: