Skip site navigation (1) Skip section navigation (2)

Re: BUG #3822: Nonstandard precedence for comparison operators

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Pedro Gimeno" <pgsql-001(at)personal(dot)formauri(dot)es>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3822: Nonstandard precedence for comparison operators
Date: 2007-12-27 22:22:10
Message-ID: 21242.1198794130@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> That said, bringing PostgreSQL into compliance with the standard
> would undoubtedly break some people's existing applications.

The spec seems to barely have a notion of operator precedence at all ---
for example, all the variants of <predicate> are at the same precedence
level, and if I'm reading it right they actively disallow ambiguous
cases by requiring parentheses; note the way that <boolean primary>
is defined.  This entire arrangement breaks down as soon as you consider
user-defined operators that yield boolean results.  So I'm not
particularly excited about the idea of slavish compliance with the spec
in this area.

To the extent that you do believe the spec, there are more problems with
our precedence rules than just where <= fits --- it looks to me like IS
[NOT] NULL is at the wrong precedence, too.  And then there's the whole
question of associativity.

> It seems to call for the same phased approach as the standard
> conforming string literals, with GUCs to control warnings for problem
> constructs and legacy versus standard runtime behavior.

Good luck implementing that --- the precedence is hard-wired into the
bison grammar rules.  There are also extremely good reasons for not
having GUC variables that affect parsing behavior.

Given that it's been this way for ten years and no one has complained
before, I'm disinclined to change it, and even more disinclined to
invest the effort that would be involved in letting the behavior vary
at runtime.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Kevin GrittnerDate: 2007-12-27 23:16:30
Subject: Re: BUG #3822: Nonstandard precedence for comparisonoperators
Previous:From: Kevin GrittnerDate: 2007-12-27 21:25:30
Subject: Re: BUG #3822: Nonstandard precedence for comparisonoperators

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group