Re: nested-xacts cursors (was Re: Performance with new nested-xacts code)

Поиск
Список
Период
Сортировка
От Zeugswetter Andreas SB SD
Тема Re: nested-xacts cursors (was Re: Performance with new nested-xacts code)
Дата
Msg-id 46C15C39FEB2C44BA555E356FBCD6FA40184D129@m0114.s-mxs.net
обсуждение исходный текст
Ответ на nested-xacts cursors (was Re: Performance with new nested-xacts code)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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
tuple2  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


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

Предыдущее
От: Andreas Pflug
Дата:
Сообщение: Re: Adding column comment to information_schema.columns
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: nested-xacts cursors (was Re: Performance with new