From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Eric Ridge <ebr(at)tcdi(dot)com> |
Cc: | Pgsql-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Cursors and Transactions, why? |
Date: | 2004-04-05 22:44:51 |
Message-ID: | 4071E163.40602@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Eric Ridge | 2004-04-05 22:52:48 | Re: Cursors and Transactions, why? |
Previous Message | Tom Lane | 2004-04-05 22:39:54 | Re: left and overleft/notright revisited: why !>> and !<< might be poor names |