Skip site navigation (1) Skip section navigation (2)

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

From: Mike Toews <mwtoews(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thom Brown <thombrown(at)gmail(dot)com>, 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 14:29:49
Message-ID: AANLkTikILxU1urbGTuEmNSjKHsGVFzPFkCIgXuLo8f34@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-docs
On 22 June 2010 18:49, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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.
>

Sorry for adding to the non-DOC drift, but why is - assumed to be a
unary operator on an unsigned integer, rather than parsed as part of
an integer? Integers have digits with an optional - or + prefix (not
unary operators). E.g., ([+\-]?[0-9]+)

-Mike

In response to

Responses

pgsql-docs by date

Next:From: Robert HaasDate: 2010-06-23 15:06:07
Subject: Re: INTEGER range ("-2147483648" is not accepted.)
Previous:From: Thom BrownDate: 2010-06-23 08:17:58
Subject: Re: INTEGER range ("-2147483648" is not accepted.)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group