Thread: lo_import() problem
Hi, I have a problem with built-in lo_import() function. I want to store some images in my database, so I'm doing this: create table image(name varchar, id oid); Next, I want to import an image '1.jpg', which resides in '/home/username/postgres/images': INSERT INTO image (name,id) VALUES('foo',lo_import('/home/username/postgres/images/1.jpg')); I'm receiving something like this: ERROR: be_lo_import - 'can't open unix file' Why? I have full rights to database and graphics files in '/home/username/postgres/images/'. So, what's going on? Please help... regards, robert
> Why? I have full rights to database and graphics files in > '/home/username/postgres/images/'. > So, what's going on? > Please help... Does postgres? -- SA, software.net My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net> | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________
On Mon, 3 Aug 1998, Robert Nosko wrote: > Hi, > > I have a problem with built-in lo_import() function. > I want to store some images in my database, so I'm doing this: > > create table image(name varchar, id oid); > > Next, I want to import an image '1.jpg', which resides in '/home/username/postgres/images': > > INSERT INTO image (name,id) VALUES('foo',lo_import('/home/username/postgres/images/1.jpg')); > > I'm receiving something like this: > ERROR: be_lo_import - 'can't open unix file' > > Why? I have full rights to database and graphics files in > '/home/username/postgres/images/'. > So, what's going on? lo_import runs under the same userid as the postmaster (normally postgres). If that user hasn't got access, then it will fail. -- Peter T Mount peter@retep.org.uk or petermount@earthling.net Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres