From: | "Chris Velevitch" <chris(dot)velevitch(at)gmail(dot)com> |
---|---|
To: | "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Understanding how partial indexes work? |
Date: | 2007-12-06 23:29:53 |
Message-ID: | b0a3bf780712061529u742e899n76df8cfe0f081a20@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Dec 7, 2007 2:39 AM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
> On Dec 6, 2007 1:44 AM, Chris Velevitch <chris(dot)velevitch(at)gmail(dot)com> wrote:
> > I have a query on a table:-
> >
> > X between k1 and k2 or X < k1 and Y <> k3
> >
> > where k1, k2, k3 are constants.
> >
> > How would this query work, if I created an index on X and a partial
> > index on X where Y <> k3?
>
> Ummm. Using AND and OR in the same where clause without parenthesis
> is a bad idea, as the logic you might think you're expressing isn't
> the exact logic you're actually expressing. Do you mean:
Are you saying that operator precedence doesn't apply here?
When else does operator precedence not apply and where is this documented?
According to the documentation
(http://www.postgresql.org/docs/7.4/interactive/sql-syntax.html#SQL-PRECEDENCE)
X between k1 and k2 or X < k1 and Y <> k3
is the same as:-
(X between k1 and k2) or ((X < k1) and (Y <> k3))
which is what I want.
Chris
--
Chris Velevitch
Manager - Sydney Flash Platform Developers Group
m: 0415 469 095
www.flashdev.org.au
From | Date | Subject | |
---|---|---|---|
Next Message | Decibel! | 2007-12-06 23:34:25 | Re: storage size of "bit" data type.. |
Previous Message | Matthew Pulis | 2007-12-06 23:28:28 | Improving the timing of a query |