Re: Cast has higher precedence than -

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Cast has higher precedence than -
Date: 2015-05-04 00:54:08
Message-ID: 24974.1430700848@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> The problem is that :: binds more tightly than -

This is well known, and even well documented.

> Is this by design? If not, any ideas how bad it'd be to fix?

It is by design. The core argument for doing it is that '-' might have
type-dependent semantics that would not be reproduced by negating first
and casting afterwards.

Even if you could convince people that that concern is baseless, there
would be a backwards-compatibility problem. For a comparison point,
note the hurdles I had to jump to persuade people that we should change
the precedence of comparison operators --- something that has clear
support in the standard, as this change would not.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2015-05-04 02:03:15 Re: CTE optimization fence on the todo list?
Previous Message Jim Nasby 2015-05-04 00:39:29 Cast has higher precedence than -