11
votes

The Problem

I recently upgraded Liquibase to 3.6.2 from 3.4.2.

Loading seed data from a CSV into text fields now results in a CLOB resource error. Before it would simply insert the text as a value.

The Setup

I'm using Liquibase to manage migrations of my data.

I have a table with an code and description column. description is of type TEXT.

<changeSet author="" id="create-table-degrees">
  <createTable tableName="degrees">
    <column name="code"
            type="varchar(2)">
      <constraints primaryKey="true"/>
    </column>
    <column name="description"
            type="text">
      <constraints unique="true"/>
    </column>
  </createTable>
  <rollback>
    <dropTable tableName="degrees"/>
  </rollback>
</changeSet>

I have seed data in a CSV:

code,description
"D1","MASTERS"
"D2","DOCTORATE"

I load it using loadData:

<changeSet author="" id="seed-degrees">
  <loadData file="seeds/degrees.csv"
            tableName="degrees" />
</changeSet>

The Error

Unexpected error running Liquibase: CLOB resource not found: MASTERS

The Question

Is there a way to keep Liquibase from interpreting seed values as file paths instead of strings, or do I need to manually define the column types as String in loadData.

e.g. I would like to avoid having to modify the old changeSet to:

<changeSet author="" id="seed-degrees">
  <loadData file="seeds/degrees.csv"
            tableName="roles">
    <column name="description" type="string" />
  </loadData>
</changeSet>
1
Just a note that I have added an issue for this in the liquibase JIRA -- liquibase.jira.com/browse/CORE-3287slifty

1 Answers

2
votes

The workaround listed in CORE-3287: Anver S December 3, 2018, 3:07 PM

While adding an explicit column type definition as defined in original stackoverflow post

<column name="description" type="string" />

does the trick - for me it effectively requires to update already applied changesets which ideally I'd try to avoid.