Unix Technical Forum

BUG #3673: Untrusted perl language: ERROR: could not open relation 1663/16384/1259: No such file or directory

This is a discussion on BUG #3673: Untrusted perl language: ERROR: could not open relation 1663/16384/1259: No such file or directory within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 3673 Logged by: Timur Luchkin Email address: timur.luchkin@ctxm.com PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 11:10 AM
Timur Luchkin
 
Posts: n/a
Default BUG #3673: Untrusted perl language: ERROR: could not open relation 1663/16384/1259: No such file or directory


The following bug has been logged online:

Bug reference: 3673
Logged by: Timur Luchkin
Email address: timur.luchkin@ctxm.com
PostgreSQL version: 8.2.5
Operating system: Fedora Core 5 / Red Hat Ent. Linux AS 3
Description: Untrusted perl language: ERROR: could not open relation
1663/16384/1259: No such file or directory
Details:

I have stored procedure in "plperlu" language. After the call to it Im
getting "could not open relation ... No such file or directory" on any next
operation in psql (the procedure itself works fine). If I'll close the
console and reopen it again, then everything works fine again (until the
next call to it).

Perl's SP code:

CREATE OR REPLACE FUNCTION fnc_prepare_base_dir (base_path IN TEXT)
RETURNS INTEGER AS
$$
my $base_path = $_[0];
my $status = 0;

if (-d "$base_path") {
chdir("$base_path");
@files = <*.cpio>;
foreach $file (sort @files) {
if (-f "$base_path/$file") {
$status = system("cd $base_path > /dev/null; cpio --quiet -idmv
--no-absolute-filenames < $file > /dev/null; rm -f $file > /dev/null");
if ($status > 0) {
return $status;
}
}
}
return 0;
}
else {
return 5;
}
$$
LANGUAGE plperlu;


To repeat this do the next:

$psql -U tham
Welcome to psql 8.2.5, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

mydb=# SELECT * FROM fnc_prepare_base_dir
('/export/storage3/postgres/etl_data');
fnc_prepare_base_dir
----------------------
0
(1 row)

mydb=# \dt
ERROR: could not open relation 1663/16384/1259: No such file or directory
mydb=# \q

$ psql -U tham
Welcome to psql 8.2.5, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

mydb=# \dt
List of relations
Schema | Name | Type | Owner
--------+-------+-------+-------
public | cust1 | table | tham
public | abc2 | table | tham
(2 rows)

mydb=#

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 11:10 AM
Heikki Linnakangas
 
Posts: n/a
Default Re: BUG #3673: Untrusted perl language: ERROR: could not open relation 1663/16384/1259: No such file or directory

Timur Luchkin wrote:
> I have stored procedure in "plperlu" language. After the call to it Im
> getting "could not open relation ... No such file or directory" on any next
> operation in psql (the procedure itself works fine). If I'll close the
> console and reopen it again, then everything works fine again (until the
> next call to it).
>
> Perl's SP code:
> ...
> chdir("$base_path");
> ...


Don't do that. Postgres sets the current directory to the data
directory, and uses relative paths to access all the relation files.
Calling chdir will confuse the server.

You could use absolute paths in your plperlu function instead.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:51 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com