Re: Canonicalization of WHERE clauses considered harmful
| От | Tom Lane |
|---|---|
| Тема | Re: Canonicalization of WHERE clauses considered harmful |
| Дата | |
| Msg-id | 8947.1071095711@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: Canonicalization of WHERE clauses considered harmful (Kurt Roeckx <Q@ping.be>) |
| Ответы |
Re: Canonicalization of WHERE clauses considered harmful
|
| Список | pgsql-hackers |
Kurt Roeckx <Q@ping.be> writes:
> On Wed, Dec 10, 2003 at 04:54:54PM -0500, Tom Lane wrote:
>> (a AND b) OR (a AND c)
>> expands by repeated application of the distributive law to
>> (a OR a) AND (a OR c) AND (b OR a) AND (b OR c)
> This is wrong.
I don't think so. The distributive law is
a OR (b AND c) == (a OR b) AND (a OR c)
Starting from
(a AND b) OR (x AND y)
prepqual.c applies the law once to produce
((a AND b) OR x) AND ((a AND b) OR y)
and then twice more to obtain
(a OR x) AND (b OR x) AND (a OR y) AND (b OR y)
Taking a equal to x gives the case I quoted.
The real problem is that we want to run the distributive law backwards,
not forwards ...
regards, tom lane
В списке pgsql-hackers по дате отправления: