Re: queryId constant squashing does not support prepared statements

Поиск
Список
Период
Сортировка
От Dmitry Dolgov
Тема Re: queryId constant squashing does not support prepared statements
Дата
Msg-id krunf4aboagoefzshkvg4mxeo5nvs75nwsrvdchn6zctubhtxd@lbejsl63o5yu
обсуждение исходный текст
Ответ на Re: queryId constant squashing does not support prepared statements  (Dmitry Dolgov <9erthalion6@gmail.com>)
Ответы Re: queryId constant squashing does not support prepared statements
Список pgsql-hackers
> On Thu, May 22, 2025 at 10:23:31PM GMT, Sami Imseih wrote:
> > This does not get squashed:
> > Q: select where 2 in (1, 4) and
> > 1 in (5, cast(7 as int), 6, (cast(8 as int)), 9, 10, (cast(8 as text))::int);
> > R: select where $1 in ($2 /*, ... */) and
> > $3 in ($4, cast($5 as int), $6, (cast($7 as int)), $8, $9, (cast($10 as text))::int)
>
> This is interesting actually. This is the behavior on HEAD, and I don't get why
> the first list with the casts does not get squashed, while the second one does.
> I will check IsSquashableConst tomorrow unless Dmitry gets to it first.

IsSquashableConst has intentionally a limited set of test for
"constantness", in particular it does not recurse. The case above

    (cast(8 as text))::int

features two CoerceViaIO expressions one inside another, hence
IsSquashableConst returns false.



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