DataTypeFactory doesn't take database into account

Description

From http://forum.liquibase.org/topic/release-version-of-liquibase-maxdb#49382000001067003

It is working with MaxDB, but strangely enough it's breaking Derby.

We have a setup where we test some functionality against a Derby DB. Productively we're running against MaxDB (and should migrate to HANA soon.).

Liquibase core 3.1.1 works fine with the local Derby database. Adding the MaxDB extension (current master, e485362) works fine with MaxDB, but the tests break with "ERROR 42X01: Syntax error: Encountered "BYTE" at line 1, column 114."

I've traced that down to the DataTypeFactory which just has a prioritised list of implementations, but ignores the actual database. So it actually picks the BlobTypeMaxDB to ultimately generate the SQL statements for Derby.

I've attached a small test case. If you run that in maven it will fail with the same error as mentioned above. Remove the liquibase-maxdb extension from the pom and it'll work fine (but that's not a good option for us).

I've also included a small patch for liquibase-core that fixed that problem (at least for me & this specific case).

I was rather surprised that adding the extension breaks core functionality, that's not really intended, is it? I'm not sure I fully understand the priority handling, but ignoring the actual database feels odd to me.

Environment

Installs with extensions

Activity

Show:
Nathan Voxland
May 28, 2014, 3:31 PM

Applied patch from forum which added a Database parameter to all the DataTypeFactory methods.

I removed the version without the database to avoid code using the old, wrong interface

Reporter

Nathan Voxland

Fix versions

Affects versions

Priority

Critical
Configure