Обсуждение: Pygresql importing of largeobjects with loimport

Поиск
Список
Период
Сортировка

Pygresql importing of largeobjects with loimport

От
"Erny"
Дата:
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