Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
394 views
in Technique[技术] by (71.8m points)

postgresql - postgres is throwing ERROR: invalid input syntax for type integer:

here is my table structure

CREATE TABLE passenger_data (
  id SERIAL PRIMARY KEY,
    airport text,
  type_of_traffic text,
    Passenger_2009_Jan REAL,
    Passenger_2009_Feb REAL,
    Passenger_2009_Mar REAL,
    Passenger_2009_Apr REAL,
    Passenger_2009_May REAL,
    Passenger_2009_Jun REAL,
    Passenger_2009_Jul REAL,
    Passenger_2009_Aug REAL,
    Passenger_2009_Sep REAL,
    Passenger_2009_Oct REAL,
    Passenger_2009_Nov REAL,
    Passenger_2009_Dec REAL,
    Passenger_2010_Jan REAL,
    Passenger_2010_Feb REAL,
    Passenger_2010_Mar REAL,
    Passenger_2010_Apr REAL,
    Passenger_2010_May REAL,
    Passenger_2010_Jun REAL,
    Passenger_2010_Jul REAL,
    Passenger_2010_Aug REAL,
    Passenger_2010_Sep REAL,
    Passenger_2010_Oct REAL,
    Passenger_2010_Nov REAL,
    Passenger_2010_Dec REAL,
    Passenger_2011_Jan REAL,
    Passenger_2011_Feb REAL,
    Passenger_2011_Mar REAL,
    Passenger_2011_Apr REAL,
    Passenger_011_May REAL,
    Passenger_2011_Jun REAL,
    Passenger_2011_Jul REAL,
    Passenger_2011_Aug REAL,
    Passenger_2011_Sep REAL,
    Passenger_2011_Oct REAL,
    Passenger_2011_Nov REAL,
    Passenger_2011_Dec REAL,
    Passenger_2012_Jan REAL,
    Passenger_2012_Feb REAL,
    Passenger_2012_Mar REAL,
    Passenger_2012_Apr REAL,
    Passenger_2012_May REAL,
    Passenger_2012_Jun REAL,
    Passenger_2012_Jul REAL,
    Passenger_2012_Aug REAL,
    Passenger_2012_Sep REAL,
    Passenger_2012_Oct REAL,
    Passenger_2012_Nov REAL,
    Passenger_2012_Dec REAL,
    Passenger_2013_Jan REAL,
    Passenger_2013_Feb REAL,
    Passenger_2013_Mar REAL,
    Passenger_2013_Apr REAL,
    Passenger_2013_May REAL,
    Passenger_2013_Jun REAL,
    Passenger_2013_Jul REAL,
    Passenger_2013_Aug REAL,
    Passenger_2013_Sep REAL,
    Passenger_2013_Oct REAL,
    Passenger_2013_Nov REAL,
    Passenger_2013_Dec REAL,
    Passenger_2014_Jan REAL,
    Passenger_2014_Feb REAL,
    Passenger_2014_Mar REAL,
    Passenger_2014_Apr REAL,
    Passenger_2014_May REAL,
    Passenger_2014_Jun REAL,
    Passenger_2014_Jul REAL,
    Passenger_2014_Aug REAL,
    Passenger_2014_Sep REAL,
    Passenger_2014_Oct REAL,
    Passenger_2014_Nov REAL,
    Passenger_2014_Dec REAL,
    Passenger_2015_Jan REAL,
    Passenger_2015_Feb REAL,
    Passenger_2015_Mar REAL,
    Passenger_2015_Apr REAL,
    Passenger_2015_May REAL,
    Passenger_2015_Jun REAL,
    Passenger_2015_Jul REAL,
    Passenger_2015_Aug REAL,
    Passenger_2015_Sep REAL,
    Passenger_2015_Oct REAL,
    Passenger_2015_Nov REAL,
    Passenger_2015_Dec REAL,
    Passenger_2016_Jan REAL,
    Passenger_2016_Feb REAL,
    Passenger_2016_Mar REAL,
    Passenger_2016_Apr REAL,
    Passenger_2016_May REAL,
    Passenger_2016_Jun REAL,
    Passenger_2016_Jul REAL,
    Passenger_2016_Aug REAL,
    Passenger_2016_Sep REAL,
    Passenger_2016_Oct REAL,
    Passenger_2016_Nov REAL,
    Passenger_2016_Dec REAL,
    Passenger_2017_Jan REAL,
    Passenger_2017_Feb REAL,
    Passenger_2017_Mar REAL,
    Passenger_2017_Apr REAL,
    Passenger_2017_May REAL,
    Passenger_2017_Jun REAL,
    Passenger_2017_Jul REAL,
    Passenger_2017_Aug REAL,
    Passenger_2017_Sep REAL,
    Passenger_2017_Oct REAL,
    Passenger_2017_Nov REAL,
    Passenger_2017_Dec REAL,
    Passenger_2018_Jan REAL,
    Passenger_2018_Feb REAL,
    Passenger_2018_Mar REAL,
    Passenger_2018_Apr REAL,
    Passenger_2018_May REAL,
    Passenger_2018_Jun REAL,
    Passenger_2018_Jul REAL,
    Passenger_2018_Aug REAL,
    Passenger_2018_Sep REAL,
    Passenger_2018_Oct REAL,
    Passenger_2018_Nov REAL,
    Passenger_2018_Dec REAL,
    Passenger_2019_Jan REAL,
    Passenger_2019_Feb REAL,
    Passenger_2019_Mar REAL,
    Passenger_2019_Apr REAL,
    Passenger_2019_May REAL,
    Passenger_2019_Jun REAL,
    Passenger_2019_Jul REAL,
    Passenger_2019_Aug REAL,
    Passenger_2019_Sep REAL,
    Passenger_2019_Oct REAL,
    Passenger_2019_Nov REAL,
    Passenger_2019_Dec REAL,
    Passenger_2020_Jan REAL,
    Passenger_2020_Feb REAL,
    Passenger_2020_Mar REAL,
    Passenger_2020_Apr REAL,
    Passenger_2020_May REAL,
    Passenger_2020_Jun REAL,
    Passenger_2020_Jul REAL,
    Passenger_2020_Aug REAL,
    Passenger_2020_Sep REAL
    );

here is my COPY statement:

COPY passenger_data (
  id,
    airport,
  type_of_traffic,
    Passenger_2009_Jan,
    Passenger_2009_Feb,
    Passenger_2009_Mar,
    Passenger_2009_Apr,
    Passenger_2009_May,
    Passenger_2009_Jun,
    Passenger_2009_Jul,
    Passenger_2009_Aug ,
    Passenger_2009_Sep ,
    Passenger_2009_Oct ,
    Passenger_2009_Nov,
    Passenger_2009_Dec,
    Passenger_2010_Jan,
    Passenger_2010_Feb,
    Passenger_2010_Mar,
    Passenger_2010_Apr,
    Passenger_2010_May,
    Passenger_2010_Jun,
    Passenger_2010_Jul,
    Passenger_2010_Aug,
    Passenger_2010_Sep,
    Passenger_2010_Oct,
    Passenger_2010_Nov,
    Passenger_2010_Dec,
    Passenger_2011_Jan,
    Passenger_2011_Feb,
    Passenger_2011_Mar,
    Passenger_2011_Apr,
    Passenger_011_May,
    Passenger_2011_Jun,
    Passenger_2011_Jul,
    Passenger_2011_Aug,
    Passenger_2011_Sep,
    Passenger_2011_Oct,
    Passenger_2011_Nov,
    Passenger_2011_Dec,
    Passenger_2012_Jan,
    Passenger_2012_Feb,
    Passenger_2012_Mar,
    Passenger_2012_Apr,
    Passenger_2012_May,
    Passenger_2012_Jun,
    Passenger_2012_Jul,
    Passenger_2012_Aug,
    Passenger_2012_Sep,
    Passenger_2012_Oct,
    Passenger_2012_Nov,
    Passenger_2012_Dec,
    Passenger_2013_Jan,
    Passenger_2013_Feb,
    Passenger_2013_Mar,
    Passenger_2013_Apr,
    Passenger_2013_May,
    Passenger_2013_Jun ,
    Passenger_2013_Jul,
    Passenger_2013_Aug,
    Passenger_2013_Sep,
    Passenger_2013_Oct,
    Passenger_2013_Nov,
    Passenger_2013_Dec,
    Passenger_2014_Jan,
    Passenger_2014_Feb,
    Passenger_2014_Mar,
    Passenger_2014_Apr,
    Passenger_2014_May,
    Passenger_2014_Jun,
    Passenger_2014_Jul,
    Passenger_2014_Aug,
    Passenger_2014_Sep,
    Passenger_2014_Oct,
    Passenger_2014_Nov,
    Passenger_2014_Dec,
    Passenger_2015_Jan,
    Passenger_2015_Feb,
    Passenger_2015_Mar,
    Passenger_2015_Apr,
    Passenger_2015_May,
    Passenger_2015_Jun,
    Passenger_2015_Jul,
    Passenger_2015_Aug,
    Passenger_2015_Sep,
    Passenger_2015_Oct,
    Passenger_2015_Nov,
    Passenger_2015_Dec,
    Passenger_2016_Jan,
    Passenger_2016_Feb,
    Passenger_2016_Mar,
    Passenger_2016_Apr,
    Passenger_2016_May,
    Passenger_2016_Jun,
    Passenger_2016_Jul,
    Passenger_2016_Aug,
    Passenger_2016_Sep,
    Passenger_2016_Oct,
    Passenger_2016_Nov,
    Passenger_2016_Dec,
    Passenger_2017_Jan,
    Passenger_2017_Feb,
    Passenger_2017_Mar,
    Passenger_2017_Apr,
    Passenger_2017_May,
    Passenger_2017_Jun,
    Passenger_2017_Jul,
    Passenger_2017_Aug,
    Passenger_2017_Sep,
    Passenger_2017_Oct,
    Passenger_2017_Nov,
    Passenger_2017_Dec,
    Passenger_2018_Jan,
    Passenger_2018_Feb,
    Passenger_2018_Mar,
    Passenger_2018_Apr,
    Passenger_2018_May,
    Passenger_2018_Jun,
    Passenger_2018_Jul,
    Passenger_2018_Aug,
    Passenger_2018_Sep,
    Passenger_2018_Oct,
    Passenger_2018_Nov,
    Passenger_2018_Dec,
    Passenger_2019_Jan,
    Passenger_2019_Feb,
    Passenger_2019_Mar,
    Passenger_2019_Apr,
    Passenger_2019_May,
    Passenger_2019_Jun,
    Passenger_2019_Jul,
    Passenger_2019_Aug,
    Passenger_2019_Sep,
    Passenger_2019_Oct,
    Passenger_2019_Nov,
    Passenger_2019_Dec,
    Passenger_2020_Jan,
    Passenger_2020_Feb,
    Passenger_2020_Mar,
    Passenger_2020_Apr,
    Passenger_2020_May,
    Passenger_2020_Jun,
    Passenger_2020_Jul,
    Passenger_2020_Aug,
    Passenger_2020_Sep
    )
FROM 'tmp_dataframe.csv'
DELIMITER ';'
CSV HEADER;

here is how data looks:

0,Alta,"Helicopter, other",0.0,0.0,0.0,0.0,0.0,0.0,0.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,8.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,12.0,0.0,162.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,11.0,70.0,98.0,117.0,151.0,128.0,93.0,98.0,11.0,0.0,0.0,0.0,0.0,0.0,15.0,0.0,0.0,0.0,0.0,0.0,0.0,13.0,0.0,0.0,0.0,4.0,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0

and I am getting below error after running copy statement

ERROR: invalid input syntax for type integer: "1,Alta,Other commercial flights,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,136.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,155.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0"

any suggestions pls

question from:https://stackoverflow.com/questions/65940760/postgres-is-throwing-error-invalid-input-syntax-for-type-integer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...