Re: stable function called for every row?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: stable function called for every row?
Дата
Msg-id 4158.1231361526@sss.pgh.pa.us
обсуждение исходный текст
Ответ на stable function called for every row?  (Gerhard Heift <ml-postgresql-20081012-3518@gheift.de>)
Список pgsql-general
Gerhard Heift <ml-postgresql-20081012-3518@gheift.de> writes:
> The function is called for every row in the table if it is stable or
> volatile and only once if it is immutable?

Yes, possibly.

> I thought it had to be called only once, if it is stable.

No.  Stable means that it is *okay* to call it only once per query,
not that that is *guaranteed* to happen.  (What it really does is give
the planner license to use an indexscan on a condition involving the
function --- an indexscan's comparison value is evaluated just once,
so it would give the wrong answers for a non-stable function.)

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SPI_ERROR_CONNECT in plperl function
Следующее
От: "c k"
Дата:
Сообщение: Fail of a return query from plpgsql function for a specific table