Re: Making CASE error handling less surprising

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: Making CASE error handling less surprising
Дата
Msg-id 20200723210954.pby6755szb2flmut@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: Making CASE error handling less surprising  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Making CASE error handling less surprising  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

On 2020-07-23 16:56:44 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > Hm. Would SQL function inlining be a problem? It looks like that just
> > substitutes parameters. Before calling
> > eval_const_expressions_mutator(). So we'd not know not to evaluate such
> > "pseudo constants".  And that'd probably be confusing, especially
> > because it's not exactly obvious when inlining happens.
> 
> Hm, interesting question.  I think it might be all right without any
> further hacking, because the parameters we care about substituting
> would have been handled (or not) before inlining.  But the interactions
> would be ticklish, and surely worthy of a test case or three.

I'm a bit worried about a case like:

SELECT foo(17);
CREATE FUNCTION yell(int, int)
RETURNS int
IMMUTABLE
LANGUAGE SQL AS $$
   SELECT CASE WHEN $1 != 0 THEN 17 / $2 ELSE NULL END
$$;

EXPLAIN SELECT yell(g.i, 0) FROM generate_series(1, 10) g(i);

I don't think the parameters here would have been handled before
inlining, right?

Greetings,

Andres Freund



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Making CASE error handling less surprising
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: heap_abort_speculative() sets xmin to Invalid* without HEAP_XMIN_INVALID