Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Started by Jeroen Schaapover 27 years ago11 messagesgeneral
Jump to latest
#1Jeroen Schaap
jeroen@rulffh.medfac.leidenuniv.nl

Here is something I totally don't understand. And i need this one to be
fixed...

Here is a transcript of a session, with a test-table containing only
one oid-column....

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

EOF
[jeroen@rulgfu sql]$ ls -l test.sql
-rw-r--r-- 1 jeroen postgres 53 Nov 12 15:48 test.sql
[jeroen@rulgfu sql]$ cat test.sql
insert into testfile values (lo_import('test.sql'));

First I thought it was the permissions... but not at all... look above

Then I thought, well, on my old slackware box it ran beautifully... so
let's try that (self-compiled) version (6.3.3 i believe....)... but no
difference.

Does anybody have a clue (please???)

Thanks in advance!!!!!

(At CET 0900 to 1700 you can also call me if you like...)

Jeroen

Jeroen Schaap.............I was dreaming of guitarnotes that would irritate
Homepage: <http://rulffh.medfac.leidenuniv.nl&gt;..| ^|^ |...an executive kind
Keywords: Guitars, Linux, Mac and SCN...........\_`-'_/..............of guy
Tel: (0)71-5276811................................| |...........Frank Zappa

#2Jeroen Schaap
jeroen@rulffk.medfac.leidenuniv.nl
In reply to: Jeroen Schaap (#1)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Not sure, but try putting the file on the same machine that your backend runs,
e.g. the /tmp directory of the machine that the backend is installed.

Hope it helps.

It's a pity. It's on the same machine.

Thanks anyway

Somebody else?

Jeroen

#3Jeroen Schaap
jeroen@rulffk.medfac.leidenuniv.nl
In reply to: Jeroen Schaap (#2)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Sounds like a file ownership problem to me. My recommendations:

To me also, but i can't find the clue...

First make sure you have the manager userid defined mine is

user postgres uid=100 gid=233 home directory=/var/lib/pgsql

make sure this user owns the home directory /var/lib/pgsql as well as all
the sub directories and files.

there was a minor fault in that dir. some dirs still were at
postgres.233
did a chmod -R postgres.postgres /var/lib/pgsql
Should be sufficient, i'd say.

Then log in as this user and run your tests.

Still i get the same results...

Thanks,

Jeroen

#4A James Lewis
james@vrtx.net
In reply to: Jeroen Schaap (#1)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

I tried to do lo_import from psql... it worked under 6.3.2 but I couldn't
do a lo_export...

I'd love to be able to do this too... must be form psql though.... if
anyone could let me know if that's possible and give me the syntax I'd be
greatful.

Cheers....

On Thu, 12 Nov 1998, Jeroen Schaap wrote:

Here is something I totally don't understand. And i need this one to be
fixed...

Here is a transcript of a session, with a test-table containing only
one oid-column....

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

EOF
[jeroen@rulgfu sql]$ ls -l test.sql
-rw-r--r-- 1 jeroen postgres 53 Nov 12 15:48 test.sql
[jeroen@rulgfu sql]$ cat test.sql
insert into testfile values (lo_import('test.sql'));

First I thought it was the permissions... but not at all... look above

Then I thought, well, on my old slackware box it ran beautifully... so
let's try that (self-compiled) version (6.3.3 i believe....)... but no
difference.

Does anybody have a clue (please???)

Thanks in advance!!!!!

(At CET 0900 to 1700 you can also call me if you like...)

Jeroen

Jeroen Schaap.............I was dreaming of guitarnotes that would irritate
Homepage: <http://rulffh.medfac.leidenuniv.nl&gt;..| ^|^ |...an executive kind
Keywords: Guitars, Linux, Mac and SCN...........\_`-'_/..............of guy
Tel: (0)71-5276811................................| |...........Frank Zappa

James (james@linuxrocks.co.uk)
Vortex Internet
My Windows unders~1 long filena~1, and yours?

#5Brook Milligan
brook@trillium.NMSU.Edu
In reply to: Jeroen Schaap (#1)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

Isn't the problem that the backend expects test.sql to be in the data
directories somewhere? Try a full path.

Cheers,
Brook

#6Jeroen Schaap
jeroen@rulffk.medfac.leidenuniv.nl
In reply to: Jeroen Schaap (#1)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Brook Milligan wrote:

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

Isn't the problem that the backend expects test.sql to be in the data
directories somewhere? Try a full path.

Good guess. Nevertheless, didn't work.

Jeroen

#7Bruce Momjian
bruce@momjian.us
In reply to: Jeroen Schaap (#6)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Brook Milligan wrote:

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

Isn't the problem that the backend expects test.sql to be in the data
directories somewhere? Try a full path.

Good guess. Nevertheless, didn't work.

I think it is broken, but we will have a patch soon.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#8Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#7)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Bruce Momjian wrote:

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

Isn't the problem that the backend expects test.sql to be in the data
directories somewhere? Try a full path.

Good guess. Nevertheless, didn't work.

I think it is broken, but we will have a patch soon.

I'm staying tuned!!

Bot how do you explain /boot/vmlinuz can be imported prefectly?

I can't.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#9Bruce Momjian
bruce@momjian.us
In reply to: Jeroen Schaap (#6)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Brook Milligan wrote:

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

Isn't the problem that the backend expects test.sql to be in the data
directories somewhere? Try a full path.

Good guess. Nevertheless, didn't work.

Jeroen

Try this patch.

---------------------------------------------------------------------------

Tatsuo Ishii
t-ishii@sra.co.jp
---------------------------------------------------------------------------
*** postgresql-v6.4/src/backend/storage/large_object/inv_api.c~	Thu Nov  5 17:48:26 1998
--- postgresql-v6.4/src/backend/storage/large_object/inv_api.c	Thu Nov 12 15:52:59 1998
***************
*** 549,556 ****
  				tuplen = inv_wrnew(obj_desc, buf, nbytes - nwritten);
  			else
  				tuplen = inv_wrold(obj_desc, buf, nbytes - nwritten, tuple, buffer);
  		}
! 		ReleaseBuffer(buffer);
  		/* move pointers past the amount we just wrote */
  		buf += tuplen;
--- 549,557 ----
  				tuplen = inv_wrnew(obj_desc, buf, nbytes - nwritten);
  			else
  				tuplen = inv_wrold(obj_desc, buf, nbytes - nwritten, tuple, buffer);
+ 			ReleaseBuffer(buffer);
  		}
! 

/* move pointers past the amount we just wrote */
buf += tuplen;

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#10Jeroen Schaap
jeroen@rulffk.medfac.leidenuniv.nl
In reply to: Bruce Momjian (#7)
Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Bruce Momjian wrote:

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

Isn't the problem that the backend expects test.sql to be in the data
directories somewhere? Try a full path.

Good guess. Nevertheless, didn't work.

I think it is broken, but we will have a patch soon.

I'm staying tuned!!

Bot how do you explain /boot/vmlinuz can be imported prefectly?

Jeroen

#11Jeroen Schaap
jeroen@rulffk.medfac.leidenuniv.nl
In reply to: Bruce Momjian (#9)
Solved...Re: [GENERAL] Failing lo_import on RH 5.1 -- postgresql-6.3.2 (please help-I'm on my knees..)

Bruce Momjian wrote:

Brook Milligan wrote:

[jeroen@rulgfu sql]$ psql -f test.sql
insert into testfile values (lo_import('test.sql'));
ERROR: be_lo_import: can't open unix file"test.sql"

Isn't the problem that the backend expects test.sql to be in the data
directories somewhere? Try a full path.

Try this patch.

I found the problem:
RH 5.1 sets the home directories unsearchable by others.
Setting chmod ag+x <home-dir> helped
Full paths are needed.

Thanks a lot everyone!!

And oh... I've applied the patch. Anyone interested in the regression
results?

Jeroen