From: jaalaw1 <jaalaw1@uswest.net>
To: pgsql-interfaces@postgresql.org
Subject: lo_import: cannot lo_import linux files
Date: Sun, 05 Nov 2000 12:38:00 -0800
Message-ID: <3A05C528.F1B05899@uswest.net> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: jaalaw1@uswest.net
Subject: Re: lo_import: cannot lo_import linux files
In-Reply-To: <3A05C528.F1B05899@uswest.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox