Re: Order of operations in postgreSQL.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Order of operations in postgreSQL.
Дата
Msg-id 3845.1685627497@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Order of operations in postgreSQL.  ("Ken McClaren" <ken.mcclaren@kipuhealth.com>)
Ответы Re: Order of operations in postgreSQL.  ("Ken McClaren" <ken.mcclaren@kipuhealth.com>)
Список pgsql-bugs
"Ken  McClaren" <ken.mcclaren@kipuhealth.com> writes:
> Yes, the error is correct, but it should never have occurred.
> The join should have eliminated the error condition before it was evaluated by the where clause. That is the case
whenthis type of statement is executed in SQL Server. 

Postgres does not promise that JOIN conditions are evaluated before WHERE
conditions.  I rather doubt that SQL Server does either, because it'd
cripple performance for a lot of real-world queries.

If you need something like that, you should restructure the query into two
levels with an optimization fence between them.  One way is

   SELECT ... FROM
     (SELECT ... FROM t1 JOIN t2 ON join-condition OFFSET 0) ss
   WHERE risky-where-condition

            regards, tom lane



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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17954: Postgres startup fails with `could not locate a valid checkpoint record`
Следующее
От: "Ken McClaren"
Дата:
Сообщение: Re: Order of operations in postgreSQL.