Pygresql importing of largeobjects with loimport - Mailing list pgsql-interfaces

From Erny
Subject Pygresql importing of largeobjects with loimport
Date
Msg-id 3b0c7b26@news
Whole thread Raw
List 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






pgsql-interfaces by date:

Previous
From: Hans-Jürgen Schönig
Date:
Subject: ECPG error: break statement not within loop or switch
Next
From: Iassen Hristov
Date:
Subject: dbExpress driver for PostgreSQL