Re: "invalid input syntax for integer" for number with exponent

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: "invalid input syntax for integer" for number with exponent
Дата
Msg-id CAKFQuwa-qSGUAAuyCMEcUOOnow3Wi4ypj4Lee9B7xAGvSa=6hw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: "invalid input syntax for integer" for number with exponent  (Bzzzz <lazyvirus@gmx.com>)
Список pgsql-novice
On Wed, Feb 28, 2018 at 2:24 PM, Bzzzz <lazyvirus@gmx.com> wrote:
On Wed, 28 Feb 2018 21:16:37 +0000
Stephen Froehlich <s.froehlich@cablelabs.com> wrote:

> I'm getting the following error when trying to go from R to a bigint
> field in PostgreSQL.
>
> COPY invalid input syntax for integer: "1.12589990684262e+015"
>
> Do I need to convert the number into text manually in R? Exactly what
> about this input is confusing PostgreSQL?


SELECT '1e4'::integer; -- fails with the same message in PostgreSQL; the text input function for integers doesn't understand scientific notation.

You will need to ensure that R outputs its numbers in non-scientific format in order to copy them into PostgreSQL via an intermediate text file.

Take a closer look at this number: is it a FLOAT, not an integer, thus
you get an error trying to insert a float in an integer column.

​Uh, no, that is not what the error is saying...though it is quite possible if this error wasn't present what you say might happen.  The OP does have confusion somewhere in the schema since the copy command is trying to use integer while the stated desire is bigint.

David J.

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

Предыдущее
От: Bzzzz
Дата:
Сообщение: Re: "invalid input syntax for integer" for number with exponent
Следующее
От: "Dale Schmitz"
Дата:
Сообщение: pg_query won't execute