Error 22003 integer out of range

I'm having essentially the same issue as in #227, except the posted solution does nothing to fix it for me. I should note that these integers represent date-and-time information, so 18-03-03 23...

I’m having essentially the same issue as in #227, except the posted solution does nothing to fix it for me.

I should note that these integers represent date-and-time information, so 18-03-03 23:59:24 —> 180303235924, etc. The information should thus perhaps rather be stored it string form, so I tried casting typt integer to string, but that did not work either.

Is this unexpected behaviour or am I simply showing my SQL inexperience?

With «cast» (bigint) command output example:

pgloader --cast "type integer to bigint" 04-03-2018.db postgresql:///mapping
2018-03-07T21:10:53.872000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235924" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235924"
2018-03-07T21:10:53.872000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235930" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235930"
2018-03-07T21:10:53.872000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235926" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235926"
2018-03-07T21:10:54.072000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235927" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235927"
2018-03-07T21:10:54.073000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235929" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235929"
^Z
[31]+  Stopped                 pgloader --cast "type integer to bigint" 04-03-2018.db postgresql:///mapping

With «cast» (string) command output example:

pgloader --cast "type integer to string" 04-03-2018.db postgresql:///mapping
2018-03-07T20:49:46.652000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235924" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235924"
2018-03-07T20:49:46.655000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235930" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235930"
2018-03-07T20:49:46.655000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235926" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235926"
2018-03-07T20:49:46.655000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235927" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235927"
2018-03-07T20:49:46.656000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235929" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235929"
^Z
[29]+  Stopped                 pgloader --cast "type integer to string" 04-03-2018.db postgresql:///mapping

Without «cast» command output example:

pgloader 04-03-2018.db postgresql:///mapping
2018-03-07T21:04:31.680000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235924" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235924"
2018-03-07T21:04:31.682000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235930" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235930"
2018-03-07T21:04:31.682000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235926" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235926"
2018-03-07T21:04:31.682000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235927" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235927"
2018-03-07T21:04:31.682000Z ERROR PostgreSQL ["points"] Database error 22003: value "180303235929" is out of range for type integer
CONTEXT: COPY points, line 1, column gps_time: "180303235929"
^Z
[30]+  Stopped                 pgloader 04-03-2018.db postgresql:///mapping

Version:

pgloader --version
pgloader version "3.4.1"
compiled with SBCL 1.3.3.debian

Driver86

mysql

  • MySQL

  • SQL

SELECT (`likes` - `dislikes`) AS `rating` FROM `article`

Этот запрос возвращает возвращает ошибку, если `likes` и/или `dislikes` — unsigned:

SQLSTATE[22003]: Numeric value out of range: 1690 BIGINT UNSIGNED value is out of range

Почему? `rating` автоматически приводится к типу unsigned? Или что?

Уточню, что все значения не превышают рамки INTEGER: −2 147 483 648 до 2 147 483 647


  • Вопрос задан

    более трёх лет назад

  • 2078 просмотров


Комментировать


Решения вопроса 1

Driver86

Короче, как я и думал :)
www.mysql.ru/docs/man/Column_types.html

Предупреждение: следует помнить, что при выполнении вычитания между числовыми величинами, одна из которых относится к типу UNSIGNED, результат будет беззнаковым!

  • Еще более забавные вещи бывают в ситуациях с decimal арифметикой и null…

Пригласить эксперта


Ответы на вопрос 1

  • Driver86

    я этот проект только делаю. Там значения 0-5… какие миллиарды))) Я склоняюсь, что дело реально в том, что «AS `rating`» автоматически становится unsigned, к тому же случайно заметил, что там, где результат не выходит в минус — ошибки нет.

  • А тип данных какой у обоих полей? NULL нигде не затесался в значениях?

  • Driver86

    mletov: `likes` int(10) UNSIGNED NOT NULL, `dislikes` int(10) UNSIGNED NOT NULL, во всех полях этих столбцов значения от 0 и выше, нигде нет null

  • All integer types can have an optional (nonstandard) attribute UNSIGNED. Unsigned type can be used to permit only nonnegative numbers in a column or when you need a larger upper numeric range for the column. For example, if an INT column is UNSIGNED, the size of the column’s range is the same but its endpoints shift from -2147483648 and 2147483647 up to 0 and 4294967295.

  • Если по-русски, то UNSIGNED — только положительные числа


Похожие вопросы


  • Показать ещё
    Загружается…

09 февр. 2023, в 14:22

1500 руб./за проект

09 февр. 2023, в 13:58

2000 руб./за проект

09 февр. 2023, в 13:28

777 руб./за проект

Минуточку внимания

Импортирую данные через DBeaver(Postgres)

Error occurred during batch insert
(you can disable batch insert in order to skip particular rows).

Причина:
 SQL Error [22003]: Batch entry 0 INSERT INTO public.standard ("number",fio)
    VALUES (79013657371,'��������') was aborted: ОШИБКА: целое вне диапазона  Call getNextException to see other errors in the batch.

В самом файле:

79013657371,Ярослава

Ему не нравится русские сиволы я так полагаю, но какую кодировку и на что поставить?

Ответы (1 шт):

src/backend/po/ru.po-msgid "integer out of range"
src/backend/po/ru.po:msgstr "целое вне диапазона"

Кириллица определённо не должна вызывать ошибку integer out of range. Проверьте тип данных поля number, подходящий ли у него тип данных. Тип integer однозначно не годится.

Затем смотрите, нет ли в таблице каких триггеров или generated columns или default nextval, не вызывают ли переполнение int какие-то другие условия.

→ Ссылка

Problem

I’m running a stream which uses a SQL Source node. The datasource uses the SQL Server Native Client 10.0 ODBC driver.
The table in the SQL Server 2008 database has a decimal 15,5 field.
Running the stream gives below error.
Error Message: 22003 [Microsoft][SQL Server Native Client 10.0]Numeric value out of range

Resolving The Problem

This problem has been reported to SPSS Development — Workaround Available
This is working as designed.
As a workaround, use float instead of decimal.
More information about he use of float and decimal can be found in the Help of SQL Server 2008

Related Information

[{«Product»:{«code»:»SS3RA7″,»label»:»IBM SPSS Modeler»},»Business Unit»:{«code»:»BU059″,»label»:»IBM Software w/o TPS»},»Component»:»Modeler»,»Platform»:[{«code»:»PF033″,»label»:»Windows»}],»Version»:»13.0″,»Edition»:»»,»Line of Business»:{«code»:»LOB10″,»label»:»Data and AI»}}]

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error 22 no such partition press any key to continue
  • Error 22 bosch варочная панель
  • Error 22 a critical error has occurred while initializing directdraw diablo 2 как исправить
  • Error 217 roblox
  • Error 217 bios layout does not match

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии