Thread: lo_import problems
Hi, I'm trying to write an script in Perl5 that do an lo_import, but using the one that the perl interface offers returns an oid equal to zero: ... $conn = Pg::connectdb("dbname=test"); $lobjId = $conn->lo_import($file); ... Where $file is the file to be imported into the database. If I try to do as in Chapter 45: INSERT INTO image (name, raster) VALUES ('beautiful image', lo_import('/etc/motd')); I get the following error: ERROR: You must have Postgres superuser privilege to use server-side lo_import(). Anyone can use the client-side lo_import()provided by libpq. And, indeed, this only works when logged on as superuser on the database, but not with the others. Thanks in advance. -- Is your job running? You'd better go catch it!
Igor Gavriloff <igor@nupes.cefetpr.br> writes: > I'm trying to write an script in Perl5 that do an lo_import, but > using the one that the perl interface offers returns an oid equal to > zero: > ... > $conn = Pg::connectdb("dbname=test"); > $lobjId = $conn->lo_import($file); lo_import, like all LO operations, has to be executed inside a transaction block (BEGIN/END SQL commands). This is, um, poorly documented in the Perl interface's docs, though you can read about it in the docs for the underlying C library libpq. regards, tom lane
On Tue, 18 Apr 2000, Igor Gavriloff wrote: > Hi, > > I'm trying to write an script in Perl5 that do an lo_import, but > using the one that the perl interface offers returns an oid equal to > zero: > > ... > $conn = Pg::connectdb("dbname=test"); BEGIN; > $lobjId = $conn->lo_import($file); COMMIT; Karel