Re: INTEGER range ("-2147483648" is not accepted.) - Mailing list pgsql-docs

From Tom Lane
Subject Re: INTEGER range ("-2147483648" is not accepted.)
Date
Msg-id 11645.1277257777@sss.pgh.pa.us
Whole thread Raw
In response to Re: INTEGER range ("-2147483648" is not accepted.)  (Thom Brown <thombrown@gmail.com>)
Responses Re: INTEGER range ("-2147483648" is not accepted.)  (Thom Brown <thombrown@gmail.com>)
Re: INTEGER range ("-2147483648" is not accepted.)  (Mike Toews <mwtoews@gmail.com>)
List pgsql-docs
Thom Brown <thombrown@gmail.com> writes:
> Is that the right behaviour though?  Shouldn't the signed value reach
> the cast step rather than the absolute value?  Or maybe Postgres could
> implicitly accept -12345::integer to be (-12345)::integer.  Is there a
> blocking reason as to why it must work this way?

Yes.  There is no reason to assume that - means the same thing for every
datatype.  In general, :: should (and does) bind tighter than *every*
operator, to ensure that the appropriately typed operator is applied.

            regards, tom lane

pgsql-docs by date:

Previous
From: Thom Brown
Date:
Subject: Re: INTEGER range ("-2147483648" is not accepted.)
Next
From: Thom Brown
Date:
Subject: Re: INTEGER range ("-2147483648" is not accepted.)