db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eirik Bjorsnos (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DDLUTILS-235) Platform.alterTables detects way too many changes
Date Tue, 03 May 2011 14:02:03 GMT

    [ https://issues.apache.org/jira/browse/DDLUTILS-235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13028235#comment-13028235
] 

Eirik Bjorsnos commented on DDLUTILS-235:
-----------------------------------------

Note that PlatformInfo.getTargetJdbcType is also called from:

ColumnDefinitionChange.isSizeChanged
ColumnDefinitionChange.isSizeReduced
ColumnDefinitionChange.isTypeChanged

as well as: 

ModelComparator.compareColumns
MSSqlModelComparator.getRelevantChangedColumns
PlatformImplBase.getObjectFromResultSet
SqlBuilder.columnsDiffer

So there's probably more than just one comparison that will need to be addressed to fix this
issue. 

> Platform.alterTables detects way too many changes  
> ---------------------------------------------------
>
>                 Key: DDLUTILS-235
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-235
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core (No specific database)
>    Affects Versions: 1.0
>            Reporter: Björn Schmidt
>            Assignee: Thomas Dudziak
>            Priority: Minor
>
> When creating an ALTER-Script from two identical databases-Models obtained from an unchanged
HSQLDB-Database (using the same database-model also does the trick), all SQLBuilders of all
Platforms I've tried (including the HSQDB-Platform) generate SQL-Output, that creates temporary
tables for each table, copies the content of the original tables into the temporary ones,
drops the old tables, creates everything anew and copies the data back again recreating all
constraints like they have been before.
> That is quite a lot of work for actually not changing anything.
> I've debugged a bit and found out, that the ModelComparator detects column-type changes
by mapping the source-model's type via the platformspecific typemappings to the type of the
target model (which remains unmapped). 
> if (_platformInfo.getTargetJdbcType(targetColumn.getTypeCode()) != sourceColumn.getTypeCode())
> {
>     changes.add(...);
> }
> This seems like a bug to me.
> Please correct me if I'm wrong, but I thought that a ddl-Database, as a model, does not
include any specifications about the type or configuration of the database it has been extracted
from. When comparing two databases for changes, the comparisions should then also be free
of platform specific details. Those are only necessary when generating the SQL-Statements
implementing the detected changes.
> I've patched the ModelComparator by changing the aforementioned line to
> if (targetColumn.getTypeCode() != sourceColumn.getTypeCode()) 
> {
>      changes.add(...);
> }
> and now the Changedetection works like I would expect it to do (no changes on identical
models, no unnecessary table- or contraint-drops).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message