Re: BUG #18965: Issue with Short-Circuit Evaluation in Boolean Expressions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #18965: Issue with Short-Circuit Evaluation in Boolean Expressions
Дата
Msg-id 2145178.1750444630@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #18965: Issue with Short-Circuit Evaluation in Boolean Expressions  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> CREATE OR REPLACE FUNCTION raise(
>     IN          i_msg           text
> )
> RETURNS text AS $$
> BEGIN
>     RAISE EXCEPTION '%', i_msg;
>     RETURN ''::text;
> END;$$
> LANGUAGE PLPGSQL
> IMMUTABLE STRICT;

I think the fundamental problem you're having is that you marked
this function IMMUTABLE, which gives the planner license to
pre-evaluate it.  It had better be VOLATILE to discourage advance
evaluation.

https://www.postgresql.org/docs/current/xfunc-volatility.html

            regards, tom lane



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