--- Begin Message ---
Subject: |
Re: [PATCH] Correctly group reduced boolean operations |
Date: |
Wed, 06 Apr 2016 23:06:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) |
Hi Yoni,
On Wed, Apr 06 2016, Yoni Rabkin <address@hidden> wrote:
> I finally got around to this. Here is the issue I see, and perhaps you
> can show me different queries where your patch works:
>
> The output of this call with the original code:
>
> (rt-liber-compile-query
> (and (queue "jobs")
> (owner "Nobody")
> ((or (status "new")
> (status "open")))))
>
Nevermind! I didn't realize you could simply add extra parentheses. My
mistake :)
It is not a bug after all then.
I can see the issue with the AND operator and its precedence. My
original issue was that I needed to add parentheses around the OR
operator.
> is:
>
> "Queue = 'jobs' AND Owner = 'Nobody' AND (Status = 'new' OR Status =
> 'open')"
>
> This correctly reflects the query since (queue "jobs"), (owner
> "Nobody"), and ((or (status "new") (status "open"))) are all arguments
> to AND. The additional parenthesis in the sexp around the 'or correctly
> groups the two "Status" predicates.
>
> However, with your patch the output is:
>
> "((Queue = 'jobs' AND Owner = 'Nobody') AND ((Status = 'new' OR Status =
> 'open')))"
>
> This gives precedence to (Queue = 'jobs' AND Owner = 'Nobody'), but that
> precedence is not reflected in the original query.
However, thanks for taking a look at it. I will let you know if I come
across other bugs.
--
Martin Jesper Low Madsen
» martinjlowm.dk
» address@hidden
» +45 2068 5551
--- End Message ---