| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | Peter Eisentraut <peter_e(at)gmx(dot)net> | 
| Cc: | pgsql-hackers(at)postgreSQL(dot)org | 
| Subject: | Re: Precedence of standard comparison operators | 
| Date: | 2015-02-20 20:44:23 | 
| Message-ID: | 28751.1424465063@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> We could check if there is a >= or <= as a child of another general
> operator.  That is already quite unlikely to begin with (except for the
> obvious common case I am forgetting right now).  We could even do this
> in an external module with a hook.  Or to be more precise, check whether
> the >= or <= was in parentheses, which we could record in the parser.
> Neither might be absolutely accurate, but it would at least give users a
> list of things to check.
> The above would imply that we add these checks before changing the
> precedence.  Creating a check under the new precendence would be much
> harder.
Hm.  Well, assuming that we're satisfied with just having a way to warn
when the behavior changed (and not, in particular, a switch that can
select old or new behavior), I think it might not be that hard.  The point
is that we're going to reduce the precedence of <= and friends, which
means that some other operator that might formerly have bound less tightly
might now bind more tightly and thereby be underneath the <= instead of
above it.  So it seems like we could adapt your idea: in transformAExprOp,
if the opname is <= etc, then check to see if the righthand argument is
another A_Expr with a multicharacter Op name.  If so warn.  As you said,
we'd need to mark parenthesized subexpressions but that might not be
horridly painful.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2015-02-20 20:55:20 | Re: POLA violation with \c service= | 
| Previous Message | Peter Geoghegan | 2015-02-20 20:39:06 | Re: INSERT ... ON CONFLICT {UPDATE | IGNORE} 2.0 |