Re: using calculated column in where-clause

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: using calculated column in where-clause
Дата
Msg-id 19546.1213900704@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: using calculated column in where-clause  ("Fernando Hevia" <fhevia@ip-tel.com.ar>)
Список pgsql-sql
"Fernando Hevia" <fhevia@ip-tel.com.ar> writes:
> -- In this case function test is called only once:
> pg=# select res[0] as sum, res[1] as prod, res[2] as dif from
> pg-# (select (test(1, 2))::integer[] as res) t ;

That's an implementation artifact, not a guaranteed behavior;
if you change the example a bit you'll find multiple calls
happening.

(In recent releases you'd actually have a better chance of
not having multiple calls if you'd declared it volatile
instead of immutable.)
        regards, tom lane


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

Предыдущее
От: "Fernando Hevia"
Дата:
Сообщение: Re: using calculated column in where-clause
Следующее
От: "Peter Kovacs"
Дата:
Сообщение: "TZ"/"tz" not supported