plperlu Question

Started by Nonameover 20 years ago2 messagesgeneral
Jump to latest
#1Noname
jbduffy@tiscali.co.uk

Hi

I have a database 'testdatabase' which is owned by a non-superuser. I want
to write a 'plperlu' function, 'import()', to process and import csv files
into the database.

I understand that as an un-trusted language 'plperlu' functions can only
be created by a superuser, so my strategy has been as follows:

su root
su postgres
psql -U postgres testdatabase ... \i my_plperlu_import_function.plperlu

This works so far. My 'import()' function is created.

However, when I run the function within psql, still as the postgres superuser,
I get a 'permission denied' response to the perl 'open(DATA, "my_csv_file")
within my 'import()' function.

The csv file is world readable as I have moved it to /tmp and given the world
'rwx' permissions.

Does my 'testdatabase' have to be owned by a superuser to run 'plperlu' functions?
Is there an alternative strategy?

Regards

John Duffy

___________________________________________________________

Tiscali Broadband from 14.99 with free setup!
http://www.tiscali.co.uk/products/broadband/

#2Doug McNaught
doug@mcnaught.org
In reply to: Noname (#1)
Re: plperlu Question

jbduffy@tiscali.co.uk writes:

However, when I run the function within psql, still as the postgres superuser,
I get a 'permission denied' response to the perl 'open(DATA, "my_csv_file")
within my 'import()' function.

The csv file is world readable as I have moved it to /tmp and given the world
'rwx' permissions.

Is this Redhat? They apparently configure SELinux to disallow
Postgres access to files outside of /var/lib/pgsql/data.

-Doug