BUG: MySQL double data type handled incorrectly by generateChangeLog

I’ve run into the following problem, and searching, here, in the archives or in google in general, doesn’t seem to be helping:

I have a table with a column of type DOUBLE, see http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html regarding mysql-isms.

Using liquibase 1.9.3, the latest mysql jdbc connector (5.1.7), against a mysql 5.0.45 server, generateChangeLog is creating the following bit of xml describing a DOUBLE column data type:

   

Which generates the following DDL when attempting to update:

zoom_coefficient DOUBLE (22) DEFAULT 0 NOT NULL,

The problem is that MySQL sees that as a syntax error, when attempting a update. I’ve run the query manually via Eclipse:SQL Explorer, and I got the same syntax error, just to make sure it wasn’t something else. MySQL expects no size to be provided along with DOUBLE. This is what should be generated:

zoom_coefficient DOUBLE DEFAULT 0 NOT NULL,

Running that in Eclipse:SQL Explorer allows the query to execute without issue.

As an aside, Eclipse:SQL Explorer which also uses JDBC, and using the same version and against the same database, reports a size for the column, in the reference database schema, as 22; however, when I ask it to generate the create table statement, it correctly outputs:

zoom_coefficient DOUBLE DEFAULT 0 NOT NULL,

I can into this exact same problem today, and it looks like a problem in the liquibase.database.structure.Column class.  The Double sql type is listed as needing a length parameter, which it doesn’t for MySql.  I’ve attached a patch that should fix the problem.  Hope this helps.

Thanks, I snuck it in with 1.9.4 that was just released, so it should work better for you now.  Thanks for the patch!

Nathan

Nathan,

I updated my project to 1.9.4 and tried generating and importing the changelog and got the same error.  The diff is still generating the wrong type for Double columns in MySQL:

     
Originally posted by: aubrey.rhodes

I updated my project to 1.9.4 and tried generating and importing the changelog and got the same error.  The diff is still generating the wrong type for Double columns in MySQL:

My step were:

  1. Updated sourceforge with 1.9.4
  2. Saw your patch
  3. Applied patch
  4. Uploaded new version of 1.9.4 within about 20 mins

I wonder if the sourceforge mirrors still have the older version.  If you try http://www.liquibase.org/liquibase-SNAPSHOT.jar does it work?

Nathan

Turns out I goofed up the patch to where it wasn’t matching correctly.  The old patch doesn’t break anything, it just doesn’t fix the bug, and I’ve attached a new patch that I’ve tested to work.  Sorry about the goof up.

Thanks.  I read through it before applying it and it seemed to make sense.  Was in too much of a hurry to test it though.  I actually committed the fix as using equalsIgnoreCase rather than changing the case, just to be safer.

You’ll have to wait for 1.9.5 or 2.0 now, however :slight_smile:

Nathan

useful for me

<a href=“http://www.e-tory-burch-outlet.com/” rel=dofollow">Tory Burch outlet online