Re: Canonicalization of WHERE clauses considered harmful - Mailing list pgsql-hackers

From Kurt Roeckx
Subject Re: Canonicalization of WHERE clauses considered harmful
Date
Msg-id 20031210225813.GA27230@ping.be
Whole thread Raw
In response to Re: Canonicalization of WHERE clauses considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Dec 10, 2003 at 05:35:11PM -0500, Tom Lane wrote:
> 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)

Oh, I was reading it wrong.

So basicly it makes a + bc = (a+b)*(a+c) = a + ab + ac + bc
And ab + ac = a * (a+b) * (a+c) * (b+c) = ab + abc + ac


(This is so much easier to read then using AND and OR.)


Kurt



pgsql-hackers by date:

Previous
From: Jason Tishler
Date:
Subject: Re: postgres panic error
Next
From: David Fetter
Date:
Subject: CSV hack