| From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
|---|---|
| To: | Andy Chambers <achambers(at)mcna(dot)net> |
| Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Cursors |
| Date: | 2011-06-15 13:39:11 |
| Message-ID: | BANLkTi=xbtzkT1pmzDce2Os+9cZfOC+oXw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Tue, Jun 14, 2011 at 11:54 PM, Andy Chambers <achambers(at)mcna(dot)net> wrote:
> Hi,
>
> What happens to cursors when new data is added to a table after you
> start iterating
> over its rows?
>
> For example, given the following loop...
>
> for rule in select tc.sid, tc.s, td.rule, td.returns
> from tcell tc
> inner join tcelldef td on (tc.p = td.p)
> where tc.iasid = current_audit_sid()
> or committed_sid in ( select committed
> from tcellread tcr
> where tc.sid = tcr.tcell )
> for update of tc loop
> ...
> end loop;
>
> some code in the loop might add a record into tcellread that causes the where
> condition to become true for a row in which it was previously false.
> Will the cursor
> eventually see it?
nope!
merlin
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Grzegorz Jaśkiewicz | 2011-06-15 13:49:13 | Re: Cursors |
| Previous Message | Craig Ringer | 2011-06-15 10:40:14 | Re: random backend crashes - Needed Information included |