Re: BUG #6723: Exception for correct query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #6723: Exception for correct query
Дата
Msg-id 1768.1341893283@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #6723: Exception for correct query  (heiko.helmbrecht@xclinical.com)
Список pgsql-bugs
heiko.helmbrecht@xclinical.com writes:
> The optimizer is using a where condition for a full table, not to the
> results of a join/subselect result, that's why it is tried to use casts,
> that cannot work on the whole table, here are the easy steps to reproduce
> the problems:

This is not a bug.  The optimizer is allowed to push conditions down
into subqueries; many people would be exceedingly unhappy if it failed
to do that.

There is a workaround you can use if you need it to not work like that,
though: add an "OFFSET 0" to the subquery.  LIMIT and OFFSET clauses
on subqueries serve as optimization fences, because the planner can't
push a WHERE condition down through one for fear of changing the set of
rows selected.

            regards, tom lane

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