Uploaded image for project: 'Liquibase Core'
  1. CORE-3399

loadData with NULL date fails with java.sql.BatchUpdateException

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 3.6.3
    • Fix versions: None
    • Environment:

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

    • Sprint:

      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.

        Attachments

          Activity

            People

            • Reporter:
              remi.roques Remi Roques
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: