Consistently read dataTypeId for all databases
Activity
Nathan Voxland July 28, 2015 at 3:25 PM
Yes, thanks. It is now being set in the oracle if branch as well.
alessioc June 25, 2015 at 11:50 AM
Thanks, but unfortunately it's still not working: the query does return the integer DATA_TYPE, but nobody propagates it to the Liquibase DataType, because in ColumnSnapshotGenerator.readDataType it is returned early in case of an Oracle database.
Nathan Voxland June 19, 2015 at 8:24 PM
Incorporated SQL and moved the oracle-specific DATA_TYPE that returned a string to DATA_TYPE_NAME
Nathan Voxland May 13, 2015 at 8:44 PM
It looks like what the oracle driver normally does in the jdbcMetaData.getColumns() method is including:
DECODE (t.data_type, 'CHAR', 1, 'VARCHAR2', 12, 'NUMBER', 3, 'LONG', -1, 'DATE', " + (this.connection.getMapDateToTimestamp()?"93":"91") + ", 'RAW', -3, 'LONG RAW', -4, 'BLOB', 2004, 'CLOB', 2005, 'BFILE', -13, 'FLOAT', 6, 'TIMESTAMP(6)', 93, 'TIMESTAMP(6) WITH TIME ZONE', -101, 'TIMESTAMP(6) WITH LOCAL TIME ZONE', -102, 'INTERVAL YEAR(2) TO MONTH', -103, 'INTERVAL DAY(2) TO SECOND(6)', -104, 'BINARY_FLOAT', 100, 'BINARY_DOUBLE', 101, 'XMLTYPE', 2009, 1111) AS data_type
in their original query to get the data type. It would have been nice if they had a translate type name -> sql.Types function that we could call but it appears hard-coded.
I think the best approach would be to include this function in the Liquibase custom SQL
alessioc May 11, 2015 at 3:18 PM
It seems like this is a side effect of fixing CORE-1491.
It appears that Liquibase reads and returns the JDBC data type (integer) for all databases except Oracle. For Oracle, it issues a dedicated SQL query that obtains the data type as a string only. Would it be possible to have the int datatype set for Oracle as well?
Some context: we integrate Liquibase in our product, where, besides using it for database migrations, it is employed to read database metadata and construct a model of the DB. With Liquibase 2, the integer data type was always returned; with 3 (tested: 3.3.2+), it is not on Oracle.