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

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

From
Jeroen Schaap
Date:
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>..| ^|^ |...an executive kind
Keywords: Guitars, Linux, Mac and SCN...........\_`-'_/..............of guy
Tel: (0)71-5276811................................| |...........Frank Zappa


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>..| ^|^ |...an executive kind
> Keywords: Guitars, Linux, Mac and SCN...........\_`-'_/..............of guy
> Tel: (0)71-5276811................................| |...........Frank Zappa

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.

George Kousi


> 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

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>..| ^|^ |...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?


       [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

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

> 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

> 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

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

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