From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kevin Grittner <kgrittn(at)ymail(dot)com> |
Cc: | "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: Precedence of standard comparison operators |
Date: | 2015-02-20 17:04:53 |
Message-ID: | 23431.1424451893@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Kevin Grittner <kgrittn(at)ymail(dot)com> writes:
> I have a memory of running into this in real-world production code
> and that it involved booleans. I'll see whether I posted something
> to the community lists about it, but it didn't take long to produce
> an (admittedly artificial) case where incorrect results are
> silently returned:
> test=# select 'f'::boolean = 'f'::boolean >= 'f'::boolean;
> ?column?
> ----------
> f
> (1 row)
> test=# select 'f'::boolean >= 'f'::boolean >= 'f'::boolean;
> ?column?
> ----------
> t
> (1 row)
One of the reasons I want to make these operators %nonassoc is
so you get an error on cases like these --- if you actually meant
this, you'll be forced to parenthesize one way or the other.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2015-02-20 17:09:55 | Re: Precedence of standard comparison operators |
Previous Message | Kevin Grittner | 2015-02-20 16:59:43 | Re: Precedence of standard comparison operators |