From: | "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at> |
---|---|
To: | "Alvaro Herrera" <alvherre(at)dcc(dot)uchile(dot)cl>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: nested-xacts cursors (was Re: Performance with new nested-xacts code) |
Date: | 2004-07-05 08:03:18 |
Message-ID: | 46C15C39FEB2C44BA555E356FBCD6FA40184D129@m0114.s-mxs.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> begin;
> declare cursor c ...;
> fetch 1 from c; -- returns tuple 1
> begin;
> fetch 1 from c; -- returns tuple 2
> rollback;
> fetch 1 from c; -- returns tuple 1 again
>
> This is mightly ugly but I think it's the most usable of the options
> seen so far.
Imho most usabel would be to handle the cursor like a hold corsor.
begin;
declare cursor c ...;
fetch 1 from c; -- returns tuple 1
begin;
fetch 1 from c; -- returns tuple 2
rollback;
fetch 1 from c; -- returns tuple 3
For me the reason is, that most likely you are not going to rollback
because the fetch did not work or returned something you don't like.
Most likely some consequent action did not work out, and the next step
will be to correct (or ignore) the problem. You can do that without an
extra fetch, because you still have the values in host variables.
resetting to "tuple 1" imho opens the door for endless loops.
Andreas
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2004-07-05 08:35:47 | Re: nested-xacts cursors (was Re: Performance with new |
Previous Message | Andreas Pflug | 2004-07-05 07:48:22 | Re: Adding column comment to information_schema.columns |