dbTalk Databases Forums  

[BUGS] BUG #2532: os.chdir call in plpython function doesn't work

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2532: os.chdir call in plpython function doesn't work in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default [BUGS] BUG #2532: os.chdir call in plpython function doesn't work - 07-16-2006 , 12:06 AM







The following bug has been logged online:

Bug reference: 2532
Logged by: Tiziano Tissino
Email address: t.tissino (AT) itaca (DOT) 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.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: [BUGS] BUG #2532: os.chdir call in plpython function doesn't work - 07-16-2006 , 12:12 AM






"Tiziano Tissino" <t.tissino (AT) itaca (DOT) coopsoc.it> writes:
Quote:
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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.