Re: Why don't we accept exponential format for integers?

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Why don't we accept exponential format for integers?
Дата
Msg-id AANLkTimpid_-XS4aWeeNxzbaD=B59J4fuQ0sYQU-MiZH@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Why don't we accept exponential format for integers?  (Bill Moran <wmoran@potentialtech.com>)
Ответы Re: Why don't we accept exponential format for integers?  (Bill Moran <wmoran@potentialtech.com>)
Re: Why don't we accept exponential format for integers?  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
On Fri, Dec 17, 2010 at 12:16 PM, Bill Moran <wmoran@potentialtech.com> wrote:
> In response to Tom Lane <tgl@sss.pgh.pa.us>:
>
>> Josh Berkus <josh@agliodbs.com> writes:
>> > postgres=# select '1e+01'::Integer
>> > postgres-# ;
>> > ERROR:  invalid input syntax for integer: "1e+01"
>>
>> I have never heard of any programming system anywhere that accepts such
>> a syntax for integers (assuming it distinguishes integers from other
>> numbers at all).  I'm not excited about being the first.  Why does this
>> error surprise you?  It doesn't seem particularly different from arguing
>> that 1.000 should be considered an integer, which strikes me as a
>> seriously bad idea.
>
> But
> SELECT 1.000::Integer;
> works.  And so does
> SELECT 1.234::Integer;

And so does:
SELECT 1.23e+01::Integer


> which I find just as dangerous as
> SELECT '1.234e+01'::Integer;

Add quotes to either of the other two, and then they don't work either.

Cheers,

Jeff


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Why don't we accept exponential format for integers?
Следующее
От: Bill Moran
Дата:
Сообщение: Re: Why don't we accept exponential format for integers?