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

From Tiziano Tissino
Subject BUG #2532: os.chdir call in plpython function doesn't work
Date
Msg-id 200607151839.k6FIdhEf087933@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #2532: os.chdir call in plpython function doesn't work
List pgsql-bugs
The following bug has been logged online:

Bug reference:      2532
Logged by:          Tiziano Tissino
Email address:      t.tissino@itaca.coopsoc.it
PostgreSQL version: 8.1.4
Operating system:   Linux (Ubuntu Dapper)
Description:        os.chdir call in plpython function doesn't work
Details:

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;

when calling it, I get an error like this one:
db=# select test(); WARNING:  plpython: in function test:
DETAIL:  plpy.SPIError: Unknown error in PLy_spi_execute_query
ERROR:  could not open relation 1663/16737/18906: No such file or directory
CONTEXT:  SQL statement "SELECT int_field FROM table1;"

The same function, without the row "chdir('/tmp')", works fine.

I just upgraded to 8.1.4; with previous db version (8.0), that function
worked fine as well.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2531: missing header dependency in src/port/Makefile
Next
From: Tom Lane
Date:
Subject: Re: BUG #2532: os.chdir call in plpython function doesn't work