Re: BUG #6360: with hold cursor, cause function executed twice and wrong results

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: BUG #6360: with hold cursor, cause function executed twice and wrong results
Дата
Msg-id CA+TgmoYDQbUGou7HgWRQXji7Sk5uT8dmaQy3VEvzFbSuXLNYCg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #6360: with hold cursor, cause function executed twice and wrong results  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Tue, Dec 27, 2011 at 12:47 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> wcting163@163.com writes:
>> The reason is that the function p_test_execute is executed twice, when
>> *fetch*, it is first executed, and when transaction commit, because the
>> cursor is a *holdable* cursor, it is executed again.
>
> Yup. =A0I don't particularly see this as a bug. =A0If you were to manually
> rewind and rescan the cursor (ie, MOVE BACKWARD ALL and re-fetch),
> the function would be executed multiple times too. =A0If you don't want
> that to happen, the best way would be to commit the transaction
> immediately, not fetch some rows and then commit.

Is that even per spec?  I would not expect the results, or the
side-effects, of a query to depend on the method used to retrieve its
results.

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #6359: excessively inlining subquery leads to slow queries
Следующее
От: Robert Haas
Дата:
Сообщение: Re: BUG #6364: The URL for the page listing user groups is unresponsive.