Pygresql importing of largeobjects with loimport

From: "Erny" <aerd(at)mx3(dot)redestb(dot)es>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: Pygresql importing of largeobjects with loimport
Date: 2001-05-24 02:46:07
Message-ID: 3b0c7b26@news
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Dear everybody,

This:
>>> import pg
>>> db=pg.DB()
>>> db.loimport("/myfile")

does not work, because Postgres requires to include this in a transaction.
So hou have to:
>>> import pg
>>> db=pg.DB()
>>> db.query("BEGIN")
>>> db.loimport("/myfile")
>>> db.query("END") # or COMMIT

Note that this is not necessary if doing a
db.query("select lo_import('/myfile')")
which is not the same as in the first example, is accessed locally from
libpq, and in the second example it is loaded from within the server, so it
must be accessible by the servir with the specified path.

Erny

Browse pgsql-interfaces by date

  From Date Subject
Next Message Selowa, Simon 2001-05-24 07:24:54 Re: ODBC Security
Previous Message Zachary Beane 2001-05-23 20:34:32 DBD::Pg or DBI breakage?