안녕하세요
csv 파일을 테이블에 올리는 방법을 알고 싶어서 이렇게 글을 올립니다.
csv 파일의 내용은
1,1975060103,,,,,,,,,17,15,17.7,15.3,18.8,16.7,19,17.3
1,1975060109,1382,15.9,167,0,72,27,0,0,19.5,14.5,18.9,14.7,18.9,16.4,19,17.1
위와 같구요
테이블 필드는
create table test(
id varchar(4) NOT NULL,
time timestamp(13) NOT NULL,
uh numeric(5),
wt numeric(5,1),
tm_20 numeric(5,1),
tm_30 numeric(5,1),
tm_40 numeric(5,1),
tm_50 numeric(5,1),
tm_60 numeric(5,1),
tm_70 numeric(5,1),
sb_05_max numeric(5,1),
sb_05_min numeric(5,1),
sb_10_max numeric(5,1),
sb_10_min numeric(5,1),
sb_20_max numeric(5,1),
sb_20_min numeric(5,1),
sb_30_max numeric(5,1),
sb_30_min numeric(5,1),
primary key(id,time)
)
위와 같은 테이블에 넣고 싶은데요
아래와 같은 명령을 사용했는데 잘 안되더라구요
copy yajang from '/home/postgres/yajang.csv' using delimiters ',' with null as ''
위의 명령을 실행시키면
Error: ERROR: copy: line 1, Bad timestamp external representation '19750601030000' (State:S1000, Native Code: 7)
이런 에러 메시지를 볼수 있습니다.
|