Re: Canonicalization of WHERE clauses considered harmful

From: Kurt Roeckx <Q(at)ping(dot)be>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Canonicalization of WHERE clauses considered harmful
Date: 2003-12-10 22:19:56
Message-ID: 20031210221955.GA26735@ping.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 10, 2003 at 04:54:54PM -0500, Tom Lane wrote:
> Currently, this is accomplished by the roundabout method of converting
> the WHERE clause to CNF (AND-of-ORs) and then simplifying duplicate
> sub-clauses within an OR:
> (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.

What would be true however is:

(a OR b) AND (b OR C)
= (a AND b) OR (a AND c) OR (b AND b) OR (b AND C)

(Replace AND by * and OR by +)

Kurt

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-12-10 22:35:11 Re: Canonicalization of WHERE clauses considered harmful
Previous Message Tom Lane 2003-12-10 22:14:22 Re: Canonicalization of WHERE clauses considered harmful