lo_import: cannot lo_import linux files

From: jaalaw1 <jaalaw1(at)uswest(dot)net>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: lo_import: cannot lo_import linux files
Date: 2000-11-05 20:38:00
Message-ID: 3A05C528.F1B05899@uswest.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

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

Browse pgsql-interfaces by date

  From Date Subject
Next Message Cedar Cox 2000-11-06 09:34:54 Re: Connecting remotely - multi tier
Previous Message Carolyn Lu Wong 2000-11-05 06:58:15 Need help with ODBC error