Cute Happy Ghost
본문 바로가기
DB/Postgresql

[postgresql] 문자형을 정수형으로 컬럼변경에러, you might need to specift USING...String to integer

by JENN_tech7 2021. 7. 15.
728x90
SMALL

integer형인 컬럼을 character varying로 변경을 했다

table명 : project

컬럼명 : time

ALTER TABLE project ALTER COLUMN time TYPE character varying;

이건 수월하게 완료가 됐다

 

 

 

 

근데 반대로 문자형을 integer형으로 변환하려고 똑같이 썼는데 에러가 나는거다

ALTER TABLE project ALTER COLUMN time TYPE integer;
ERROR:  column "time" cannot be cast automatically to type integer
HINT:  You might need to specify "USING time::integer".

정말 알다가도 모를 콤퓨타의 세계

텍스트에서 정수형으로 자동변환은 지원하지 않는다네 ㅋ... 좀 해주지;; 

 

 

 

 

 

 

 

 

ALTER TABLE project ALTER COLUMN time TYPE integer USING time::integer;

그래서 이렇게 써주니 ./. 뭐 완료.....

728x90
LIST

댓글