Re: Writing Large Objects

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Writing Large Objects
Дата
Msg-id 9391.1027494890@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Writing Large Objects  ("Chris White" <cjwhite@cisco.com>)
Список pgsql-jdbc
"Chris White" <cjwhite@cisco.com> writes:
> Documentation states that you must perform large object calls within a
> transaction. Do I need to do a commit when I have written the large object
> or does the close() on the object commit the object to the database. The
> reason I ask, is that I want to commit the object to the database
> independently of updating tables which will contain the objects oid.

Yes, you can.  The important point is that the "LO handle" you get from
lo_open() is only good for the duration of a transaction, so you must
do lo_write and lo_read calls within the transaction.  But you can hold
onto the LO's oid and write that into tables in separate transactions.

But a question for you: if your client application dies after committing
the LO and before committing the references to it from other tables, how
will you know to clean out the LO later?  I'm not at all sure that your
goal is a good idea.  I'd lean towards committing the LO and its table
reference in one transaction.

            regards, tom lane

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: bluejacksong
Дата:
Сообщение: Dave Cramer
Следующее
От: "Thomas De Vos"
Дата:
Сообщение: Re: Sequence ID from INSERT