Re: BUG #4974: Equivalent of "= ANY" and "BETWEEN" not observed by planner.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ian Turner" <ian(dot)turner(at)deshaw(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4974: Equivalent of "= ANY" and "BETWEEN" not observed by planner.
Date: 2009-08-12 02:15:19
Message-ID: 2814.1250043319@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Ian Turner" <ian(dot)turner(at)deshaw(dot)com> writes:
> The following queries are equivalent, because there are no integers between
> 5 and 6 and because the BETWEEN operator contemplates a closed range.
> SELECT * FROM example WHERE pk IN (5,6);
> SELECT * FROM example WHERE pk BETWEEN 5 AND 6;

The planner intentionally does not do very many inferences that are as
datatype-dependent as this one would be. It doesn't fit into the system
design. For the most part the possible gain is not large anyway.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2009-08-12 03:35:53 Re: Connections closed unexpectedly
Previous Message Ian Turner 2009-08-12 01:52:31 BUG #4974: Equivalent of "= ANY" and "BETWEEN" not observed by planner.