From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Precedence of standard comparison operators |
Date: | 2015-08-09 23:07:15 |
Message-ID: | 20150809230715.GB1900437@tornado.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Aug 09, 2015 at 06:44:58PM -0400, Tom Lane wrote:
> Noah Misch <noah(at)leadboat(dot)com> writes:
> > On Sun, Aug 09, 2015 at 04:48:22PM -0400, Tom Lane wrote:
> >> I'm curious about your rationale for claiming that <null predicate> has
> >> precedence exactly equal to "<" according to the spec.
>
> > Both <null predicate> and <comparison predicate> are in the set of productions
> > that take <row value predicand> arguments and appear only in <predicate>.
> > Passing a production in that set as an argument to a production in that set
> > requires parentheses. To restate (non-associative) "precedence equal" more
> > pedantically, there exists no conforming query whose interpretation hinges on
> > the relative precedence of "IS NULL" and "<".
>
> Ah. So really, according to the spec IS and "<" could have any precedence
> relative to each other as long as there is no other construct between.
> Works for me.
>
> > To my knowledge, SQL is agnostic about whether LIKE "is an operator". The six
> > comparison operators bind looser than <common value expression> syntax like
> > "*" and "||", tighter than IS TRUE, and indistinguishable from <predicate>
> > syntax like IS DISTINCT FROM and LIKE.
>
> "Indistinguishable" in the same sense as above, right?
Right.
> So for our
> purposes, it's better to keep BETWEEN and friends as binding slightly
> tighter than '<' than to make them the same precedence. Same precedence
> risks breaking things that weren't broken before.
It does risk that. Same deal with making "=" have the same precedence as "<"
instead of keeping it slightly lower.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-08-09 23:16:02 | Re: Precedence of standard comparison operators |
Previous Message | Tom Lane | 2015-08-09 22:44:58 | Re: Precedence of standard comparison operators |