Re: Broken type checking for empty subqueries

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Broken type checking for empty subqueries
Дата
Msg-id 960060.1695913059@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Broken type checking for empty subqueries  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Broken type checking for empty subqueries  (David Rowley <dgrowleyml@gmail.com>)
Список pgsql-bugs
David Rowley <dgrowleyml@gmail.com> writes:
> I've not looked at the code to see if this would be practical or not,
> but I wonder if we could reduce these bug reports by using the new
> soft error reporting that's now done in the input functions to have
> constant folding just silently not do any folding for the expression
> if a cast fails.

Sadly, I doubt that would cover enough of the problem space to make
much difference to people who try to do this sort of thing.

> ... I imagine most people who
> have had them fail during constant folding have just redesigned or
> found some hack to prevent the folding from taking place anyway.

Yeah.  The given query looks like it was already hacked to avoid
constant-folding, though I wonder if whoever wrote it really understood
that.  Otherwise it'd be a lot more natural to use something like CASE.
Anyway, adding OFFSET 0 to suppress sub-select folding is probably
the best answer here.

            regards, tom lane



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

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Broken type checking for empty subqueries
Следующее
От: Akash Kava
Дата:
Сообщение: Re: BUG #18138: Using limit on VALUES causes type conversion to fail.