I am new to postgres and trying to use pqlib lo_import(PGconn *conn, const char * filename)
to bulk insert directories of data files into a sql table with the original
pathname as the text field and the oid of the inversion filea as the oid
field.
I want to serve the files to users from the sql tables.
I use version 7.0.2-2 from the redhat rpmms on rh6.2 linux 2.2.14-5
The table I used for testing my code is:
create table images(name text, doc oid);
I used the testlo.c examples as my guide.
All of the database connectiion and file handling work as epected.
I used 'find' to generate the fully qualified path names and redirected
it to the file dirlst;
My code opens dirlst, fgets(namebuf, 127, dirlst) each pathname into
namebuf, strips the newline, assigns the new pathname to fname, all
works ok.
To actually insert the name 'fname' and oid into the sql table 'images'
my code uses:
res = PQexec(conn, "INSERT INTO images (name, doc) VALUES (fname,
lo_import(conn, fname))")
PQtrace says Error: Attribute 'fname' not found or cannot open unix file
fname or 'cannot open unix file permisision denied;
Permissions are particularly troublesome since I want to load entier
trees into the table and many trees are owned by various users with
various permissions set.
I would like some pointers on where to look in addition to the htm
files in the distribution. I am new to postgres but have used linux as
my desktop for several years.
any advice appreciated.
rod Jones