Re: 7.4.7: due to optimizing of my query logik breaks

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: 7.4.7: due to optimizing of my query logik breaks
Дата
Msg-id 3627.1126706617@sss.pgh.pa.us
обсуждение исходный текст
Ответ на 7.4.7: due to optimizing of my query logik breaks  (Christoph Frick <frick@sc-networks.com>)
Ответы Re: 7.4.7: due to optimizing of my query logik breaks  (Christoph Frick <frick@sc-networks.com>)
Список pgsql-novice
Christoph Frick <frick@sc-networks.com> writes:
> i have a zip code field in a table that is used by "international"
> customers, which lead to very "random" data there. but a query should be
> possible "by number" if there is only a number in the field. for
> queriing the table an admin user can generate queries with a visual
> interface - but the optimizier then kills my logic:

Please see
http://www.postgresql.org/docs/7.4/static/sql-expressions.html#SYNTAX-EXPRESS-EVAL
which specifically disclaims any promise of left-to-right evaluation
order.

Having said that, 8.0 and up no longer try to force the WHERE clause
into canonical AND-of-ORs form, so it's possible that what you would
like would happen in a newer version.

But my advice is to find another way to do it (maybe put the logic into
a plpgsql function?).  You will get absolutely zero sympathy for any
request to constrain evaluation order of a WHERE clause --- if we did
that it would completely defeat the ability to do query optimization of
any kind.  Accordingly, if future changes break your code again, you
won't have any recourse.

            regards, tom lane

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

Предыдущее
От: Christoph Frick
Дата:
Сообщение: 7.4.7: due to optimizing of my query logik breaks
Следующее
От: Christoph Frick
Дата:
Сообщение: Re: 7.4.7: due to optimizing of my query logik breaks