Re: Cursors and Transactions, why?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Cursors and Transactions, why?
Дата
Msg-id 4071E163.40602@joeconway.com
обсуждение исходный текст
Ответ на Cursors and Transactions, why?  (Eric Ridge <ebr@tcdi.com>)
Список pgsql-general
Eric Ridge wrote:
> Why must a cursor be defined in an open transaction?  Obviously there's
> a good reason, but I can't figure it out.  On a high level, what would
> be involved in allowing a cursor to outlive the transaction that created
> it?

Historically I think it was because the memory was released at the end
of the current transaction (i.e. allocations were made in
TopTransactionContext). But as of 7.4, cursors *can* outlive transactions:
http://www.postgresql.org/docs/current/interactive/sql-declare.html

WITH HOLD
WITHOUT HOLD

     WITH HOLD specifies that the cursor may continue to be used after
the transaction that created it successfully commits. WITHOUT HOLD
specifies that the cursor cannot be used outside of the transaction that
created it. If neither WITHOUT HOLD nor WITH HOLD is specified, WITHOUT
HOLD is the default.

HTH,

Joe


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

Предыдущее
От: Eric Ridge
Дата:
Сообщение: Re: Cursors and Transactions, why?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: left and overleft/notright revisited: why !>> and !<< might be poor names