Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 将小数字插入整数字段时,PostgreSql整数超出范围错误_Django_Postgresql - Fatal编程技术网

Django 将小数字插入整数字段时,PostgreSql整数超出范围错误

Django 将小数字插入整数字段时,PostgreSql整数超出范围错误,django,postgresql,Django,Postgresql,我在postgres中得到一个“整数超出范围”错误,尽管插入的数字都不是“大的”。他们远远低于一百万。 查询是通过Django ORM生成的,看起来非常标准。 你知道我错过了什么吗? 谢谢 可能序列已超过整数的最大值(2147483647)。因为序列是基于bigint的,所以这是可能的 您可以使用选择nextval('index\u index\u id\u seq')nextval('index\u index\u id\u seq')的值是多少?您的id列是否已长大?nextval返回一个b

我在postgres中得到一个“整数超出范围”错误,尽管插入的数字都不是“大的”。他们远远低于一百万。 查询是通过Django ORM生成的,看起来非常标准。 你知道我错过了什么吗? 谢谢


可能序列已超过整数的最大值(2147483647)。因为序列是基于bigint的,所以这是可能的


您可以使用
选择nextval('index\u index\u id\u seq')

nextval('index\u index\u id\u seq')的值是多少?您的id列是否已长大?nextval返回一个bigint。谢谢!我没想到!
# INSERT INTO "index_index" ("word_id", "ad_id", "field", "position", "created_at") VALUES (98036, 703906, E'y.x', 0, E'2011-09-29 22:02:40.252332') RETURNING "index_index"."id";
ERROR:  integer out of range

# \d index_index;

Table "public.index_index"
   Column   |           Type           |                        Modifiers                         
------------+--------------------------+----------------------------------------------------------
 id         | integer                  | not null default nextval('index_index_id_seq'::regclass)
 word_id    | integer                  | not null
 ad_id      | integer                  | not null
 field      | character varying(50)    | not null
 position   | integer                  | not null
 created_at | timestamp with time zone | not null
Indexes:
    "index_index_pkey" PRIMARY KEY, btree (id)
    "index_index_ad_id" btree (ad_id)
    "index_index_word_id" btree (word_id)
Foreign-key constraints:
    "index_index_ad_id_fkey" FOREIGN KEY (ad_id) REFERENCES campaigns_ad(id) DEFERRABLE INITIALLY DEFERRED
    "index_index_word_id_fkey" FOREIGN KEY (word_id) REFERENCES index_word(id) DEFERRABLE INITIALLY DEFERRED