Re: BUG #2532: os.chdir call in plpython function doesn't work - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2532: os.chdir call in plpython function doesn't work
Date
Msg-id 27357.1153026586@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2532: os.chdir call in plpython function doesn't work  ("Tiziano Tissino" <t.tissino@itaca.coopsoc.it>)
List pgsql-bugs
"Tiziano Tissino" <t.tissino@itaca.coopsoc.it> writes:
> I have a function like the following one:
> CREATE OR REPLACE FUNCTION public.test() RETURNS int4 AS $BODY$
> from os import chdir
> chdir('/tmp')
> test=plpy.execute('SELECT int_field FROM table1;')[0]['int_field']
> return test
> $BODY$ LANGUAGE 'plpythonu' VOLATILE;

chdir is a great way to break your database.  Don't do it.

Other things to avoid in plpythonu functions include: rm -rf,
kill -9 the postmaster, etc ...

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Tiziano Tissino"
Date:
Subject: BUG #2532: os.chdir call in plpython function doesn't work
Next
From: "Konstantin Pavlovsky"
Date:
Subject: postgresql bug on macosx