Column Type COMPUTED in loadData is not implemented correctly (shoud pass a DB Function instead of String to DB).

Description

Column Type COMPUTED in loadData is not implemented correctly (shoud pass a DB Function instead of String to DB).

Please refer to the code at line 145:
http://grepcode.com/file/repo1.maven.org/maven2/org.liquibase/liquibase-core/2.0.5/liquibase/change/core/LoadDataChange.java#LoadDataChange.generateStatements%28liquibase.database.Database%29

There it reads:
} else if (columnConfig.getType().equalsIgnoreCase("COMPUTED")) {
valueConfig.setValue(value.toString());
}

I think this should be this so the DB JDBC driver does not receive a quoted String value:
} else if (columnConfig.getType().equalsIgnoreCase("COMPUTED")) {
liquibase.statement.DatabaseFunction function = new liquibase.statement.DatabaseFunction(value.toString());
valueConfig.setValueComputed(function);
}

As an example:
BEGIN CSV country_codes_iso_single.csv
ID,ISO_CODE,NAME_NL,NAME_FR
nextval(COUNTRY_S),AD,Andorra (Vorstendom),Andorre (Principauté)
END CSV country_codes_iso_single.csv

When using loadData like this:
<loadData tableName="COUNTRY_T"
file="country_codes_iso_single.csv"
separator="," encoding="UTF-8" quotchar="&quot;">
<column name="ID" index="0" type="COMPUTED" />
<column name="ISO_CODE" index="1" type="String" />
<column name="NAME_NL" index="2" type="String" />
<column name="NAME_FR" index="3" type="String" />
</loadData>

You get:
Caused by: org.postgresql.util.PSQLException: ERROR: invalid input syntax for integer: "nextval(COUNTRY_S)"

Environment

None

Reporter

Hemm Vanrobays

Fix versions

Affects versions

Priority

Blocker
Configure