DatabaseException in changesets that include date fields with default values

Description

I have the following table:

CREATE TABLE `item_history` (
`item_id` int(11),
`date_inserted` date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (`item_id`)
)

I used the generateChangeLog command to generate this changeset:

<createTable tableName="item_history">
<column name="item_id" type="INT(11)"/>
<column defaultValueComputed="0000-00-00" name="date_inserted" type="date">
<constraints nullable="false"/>
</column>
</createTable>

When I run it, the defaultValueComputed is not put inside quotes, which means I get things like this:

Caused by: liquibase.exception.DatabaseException: Error executing SQL CREATE TABLE item_history (item_id INT(10), dateinserted date DEFAULT 0000-00-00 NOT NULL): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-00-00 NOT NULL' at line 1
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:103)
at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1513)
at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1496)
at liquibase.changelog.ChangeSet.execute(ChangeSet.java:343)
... 82 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-00-00 NOT NULL' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2819)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2768)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)
at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)

Environment

MySQL 5.1.69

Status

Reporter

Kenneth Skertchly

Components

Fix versions

Affects versions

Priority

Major
Configure