We're updating the issue view to help you get more done. 

loadData with NULL date fails with java.sql.BatchUpdateException

Description

The following changelog fails to update against a MS SQL (that is what we are using, I have not tried other RDBMS) database:

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">

<changeSet id="createTable" author="test">
<createTable schemaName="dbo" tableName="MY_TABLE" relativeToChangelogFile="true">
<column name="ID" type="NUMERIC"/>
<column name="MY_DATE" type="DATE"/>
</createTable>
</changeSet>

<changeSet id="loadUpdateData" author="test">
<loadData schemaName="dbo" tableName="MY_TABLE" relativeToChangelogFile="true" file="loaddata.csv" primaryKey="ID">
<column name="ID" type="NUMERIC"/>
<column name="MY_DATE" type="DATE"/>
</loadData>
</changeSet>

</databaseChangeLog>

with loaddata.csv being:

"ID","MY_DATE"
1,2018-01-01
2,NULL

Performing a Liquibase update results in:

java.sql.BatchUpdateException: Implicit conversion from data type varbinary to date is not allowed. Use the CONVERT function to run this query.

Note that using a loadUpdateData change set type succeeds. On the batch insert fails.

Environment

Gradle 5.2.1
Liquibase core 3.6.3
mssql-jdbc driver 7.2.1.jre8

Status

Assignee

Unassigned

Reporter

Remi Roques

Labels

None

Components

Affects versions

3.6.3

Priority

Major