Re: Unpredicatable behavior of volatile functions used in cursors

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Unpredicatable behavior of volatile functions used in cursors
Дата
Msg-id 15780.1168876227@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Unpredicatable behavior of volatile functions used in cursors  (Aleksander Kmetec <aleksander.kmetec@intera.si>)
Ответы Re: Unpredicatable behavior of volatile functions used  (Aleksander Kmetec <aleksander.kmetec@intera.si>)
Список pgsql-general
Aleksander Kmetec <aleksander.kmetec@intera.si> writes:
> We're using the following technique for counting the number of rows in a cursor:
> DECLARE instance_cur_1 SCROLL CURSOR FOR
> SELECT util.row_number(), *
> FROM (
>     $LONG_RUNNING_QUERY
> ) ss
> FETCH LAST IN instance_cur_1;

> util.row_number() is a volatile function written in C which simply returns "++internal_counter" every time it is
called.

This isn't gonna work very well if your query involves sorting, because
the SELECT-list is evaluated before the sort step ...

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Runtime error when calling function from .NET ( Function returns record)
Следующее
От: thatsanicehatyouhave@mac.com
Дата:
Сообщение: Glacially slow nested SELECT