티스토리 뷰


최근 개인적인 미니 프로젝트를 하면서 mariadb를 사용하고 있는데 date와 datetime 에 기본값을 default로 설정해주려고 하는데 아래 에러가 발생했다. 사실 지나고 쓰는거라 아래 에러 문구는 대충 검색해서 넣는거라 정확하지는 않은것 같다. 

대충 상황은 date나 datetime 타입에 기본 값을 현재 시간으로 설정하고자 할 때 나는 에러였다. 대충 구글링 하면 뭐 타입을 timestamp로 설정하면 된다는 얘기가 있는데 그건 본질적인 방법이 아니니 패스..하고.

 

Invalid default value for 'Date and time' CURRENT_TIMESTAMP


Got the following error: " SQL Error [1178] [42000]: (conn:21) The storage engine for the table doesn't support The syntax or the data type(s) is not supported by Columnstore. Please check the Columnstore syntax guide for supported syntax or data types. "

 

역시 구글링을 꽤나 오랜 시간을 한 다음 아래 링크를 찾을 수 있었고 

 

mariadb.com/kb/en/default-current_timestamp-is-not-possible/

 

DEFAULT CURRENT_TIMESTAMP is not possible

Hi, I was trying to create a table: CREATE TABLE asana_dwh.ods_currency_rate_history ( rate_date date, currency_code varchar(3), rate float, currency_rate_key varchar(32),...

mariadb.com

대충 읽어보니 버전에 문제가 있었던걸 확인했다. 기존에 사용중이던 버전은 mariadb 10.1 버전대였던 것. 홈페이지에 들어가보니 최근 버전은 10.5 버전대였고 10.2 버전대부터 date나 datetime 기본 설정을 할수 있다고 써져있었다. 

 

jira.mariadb.org/browse/MCOL-1039

 

[MCOL-1039] DATE / DATETIME should support CURRENT_TIMESTAMP - Jira

 

jira.mariadb.org


MariaDB 10.2 supports CURRENT_TIMESTAMP as a default value for DATE and DATETIME. We should therefore add support for this in ColumnStore.

 

영어가 약해서 맞게 읽은건지는 모르겠지만 우분투 서버에서 mariadb 버전을 10.5 버전 대로 업데이트 한 후에 완전히 해결되었다. 

 

에러가 발생했던 default current_timestamp나 current_timestamp() 를 default 값으로 설정할 수 있게 되었다. 


댓글
최근에 올라온 글
최근에 달린 댓글