1. Background
Before the end of the day, the database has a temporary table cert_display_tmp used to do the interface display, the table data is from T_cert_sample, Ying said the data is incorrect, and then manually perform the update function, report an integer out of range.
2. Fault Analysis2.1 Table Structure Analysis
CREATE TABLE cert_display_tmp
(
id integer NOT NULL DEFAULT nextval(‘cert_display_tmp2_id_seq‘::regclass),
cert_id bigint,
total_sample bigint NOT NULL DEFAULT 0,
CONSTRAINT cert_display_tmp2_pkey PRIMARY KEY (id)
)
The ID field of the table is a short shape, and it is also a self-increment sequence that suspects that the problem appears in this place
2.2 Overall analysis
the range of integer types is (-2147483648 to +2147483647), and then look at the next sequence value is '2147483648', just over the range of integers.
postgres=#=> select nextval(‘cert_display_tmp2_id_seq‘);
nextval
------------
2147483648
(1 row)
3, fault resolution
Change ID of the field type is bigint type, execute function again, no error, fault resolution.
ALTER TABLE CERT_DISPLAY_TMP ALTER COLUMN ID bigint
Appendix
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/84/91/wKiom1eVZ3OwrUhxAACHTw_mQYY833.png-wh_500x0-wm_3 -wmp_4-s_1471917698.png "title=" reshape Field "alt=" Wkiom1evz3owruhxaachtw_mqyy833.png-wh_50 "/>
This article is from the "Stranger, End" blog, please be sure to keep this source http://molu2013.blog.51cto.com/2615175/1829524
Postgresql reshape Field "integer out of range"