Re: INTEGER range ("-2147483648" is not accepted.)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thom Brown <thombrown(at)gmail(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, Satoshi Nagayasu <satoshi(dot)nagayasu(at)gmail(dot)com>, pgsql-docs(at)postgresql(dot)org
Subject: Re: INTEGER range ("-2147483648" is not accepted.)
Date: 2010-06-23 01:49:37
Message-ID: 11645.1277257777@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Thom Brown <thombrown(at)gmail(dot)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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Thom Brown 2010-06-23 08:17:58 Re: INTEGER range ("-2147483648" is not accepted.)
Previous Message Thom Brown 2010-06-22 23:16:06 Re: INTEGER range ("-2147483648" is not accepted.)