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

Поиск
Список
Период
Сортировка
От Mike Toews
Тема Re: INTEGER range ("-2147483648" is not accepted.)
Дата
Msg-id AANLkTikILxU1urbGTuEmNSjKHsGVFzPFkCIgXuLo8f34@mail.gmail.com
обсуждение исходный текст
Ответ на Re: INTEGER range ("-2147483648" is not accepted.)  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: INTEGER range ("-2147483648" is not accepted.)  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-docs
On 22 June 2010 18:49, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 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.
>

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

В списке pgsql-docs по дате отправления:

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: INTEGER range ("-2147483648" is not accepted.)
Следующее
От: Robert Haas
Дата:
Сообщение: Re: INTEGER range ("-2147483648" is not accepted.)