본문 바로가기
IT/Database

[Mysql] [Error] ERROR 1426: Too-big precision 10 specified for 'column'. Maximum is 6.

by 성준하이 2024. 10. 8.
반응형

create table 문법으로 mysql 에서 table을 생성하다가 제목과 같은 에러를 만났다.

 

ERROR 1426: Too-big precision 10 specified for 'column'. Maximum is 6.

 

쿼리는 아래와 같다.

 

create table Table (

..

column Timestamp(10)

..

 

에러 내용은 timestamp는 maximum 6 까지만 지정할수 있다는 의미이다.

 

해결법

 

timestamp 는 micro second 를 지원하지 않으므로 반올림 되어 6자리 까지만 가능하도록 설정해야한다.
(버전에 따라 상이할수는 있음)

Varchar(10) 으로 할 경우엔 텍스트 자체가 10자리 이지만 

timestamp 에서의 괄호 안의 숫자는 소수점을 의미하는 내용이라서 maximum 6까지만 가능하다.

 

Mysql 공식 문서에서의 의견은 아래와 같다.

MySQL의 DATETIME, TIME, TIMESTAMP 타입은 초 단위를 최대 6자리 microseconds(ms) 정확도까지 저장할 수 있으며, ms부터의 시간을 Fractional Seconds라고 한다.

https://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html

 

MySQL :: MySQL 5.7 Reference Manual :: 11.2.7 Fractional Seconds in Time Values

11.2.7 Fractional Seconds in Time Values MySQL has fractional seconds support for TIME, DATETIME, and TIMESTAMP values, with up to microseconds (6 digits) precision: To define a column that includes a fractional seconds part, use the syntax type_name(fsp)

dev.mysql.com

 

반응형

'IT > Database' 카테고리의 다른 글

[Mysql] ROWNUM 사용  (12) 2024.10.10
[Mysql] can't create test file lower-test  (11) 2024.10.04
[Mysql] 테이블 정의서 만들기  (12) 2024.07.18
[Mysql] Workbench 에서 ERD 그리기  (11) 2024.07.17
[Mysql] Trigger 사용  (8) 2024.07.16

댓글