Re: Precedence of standard comparison operators

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:36:31
Message-ID: 20150809233631.GC1900437@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 09, 2015 at 07:16:02PM -0400, Tom Lane wrote:
> Noah Misch <noah(at)leadboat(dot)com> writes:
> > On Sun, Aug 09, 2015 at 06:44:58PM -0400, Tom Lane wrote:
> >> 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.
>
> Agreed, but in that case I think our hand is forced by the SQL standard.

In SQL:2008 and SQL:2011 at least, "=", "<" and "BETWEEN" are all in the same
boat. They have no precedence relationships to each other; SQL sidesteps the
question by requiring parentheses. They share a set of precedence
relationships to other constructs. SQL does not imply whether to put them in
one %nonassoc precedence group or in a few, but we can contemplate whether
users prefer an error or prefer the 9.4 behavior for affected queries.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2015-08-09 23:51:58 Re: [patch] A \pivot command for psql
Previous Message Tom Lane 2015-08-09 23:16:02 Re: Precedence of standard comparison operators