Mike Chiemeka
Mike Chiemeka

Reputation: 1

Issue in copying a csv file to an sql table in bash environment

Hello everyone I have an issue in copying a csv file to an sql table created in bash environment

COPY new_reader FROM '/home/dataguy/samuel/read.csv' DELIMITER ';' CSV HEADER;

It shows an error:

postgres=# COPY new_reader FROM '/home/dataguy/samuel/read.csv' DELIMITER ';' CSV HEADER; ERROR: value "2458151262" is out of range for type integer CONTEXT: COPY new_reader, line 2, column user_id: "2458151262" postgres=#

I attached a snap shoot of the error display here

Upvotes: 0

Views: 38

Answers (1)

flytex
flytex

Reputation: 98

value "2458151262" is out of range for type integer

indicates that the the number is too large for the data type.

You are using a 4 byte INTEGER that has a limit of 2,147,483,647 ( 2,458,151,262 > 2,147,483,647). Instead, change the column to a BIGINT which is an 8 byte integer and will allow bigger numbers to be stored.

Upvotes: 2

Related Questions