[ 
https://issues.apache.org/jira/browse/DDLUTILS-251?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Huber updated DDLUTILS-251:
----------------------------------

    Description: 
If you add a column to an existing primary key, database updates fails with 
NullPointerException:

java.lang.NullPointerException
        at 
org.apache.ddlutils.alteration.AddPrimaryKeyChange.apply(AddPrimaryKeyChange.java)
        at 
org.apache.ddlutils.platform.SqlBuilder.processChange(SqlBuilder.java)
        at 
org.apache.ddlutils.platform.mssql.MSSqlBuilder.processTableStructureChanges(MSSqlBuilder.java)
        at 
org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java)
        at 
org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java)
        at 
org.apache.ddlutils.platform.SqlBuilder.processChanges(SqlBuilder.java)
        at 
org.apache.ddlutils.platform.mssql.MSSqlBuilder.processChanges(MSSqlBuilder.java)
        at 
org.apache.ddlutils.platform.SqlBuilder.alterDatabase(SqlBuilder.java)


Orignial table definition:

    <table name="DISPLAYNAMES">
        <column name="CLASSNAME" primaryKey="true" required="true" 
type="VARCHAR" size="200"
                autoIncrement="false"/>
        <column name="FIRMWAREID" primaryKey="true" required="true" 
type="INTEGER" size="10"
                autoIncrement="false"/>
        <column name="LANGUAGE" primaryKey="true" required="true" type="CHAR" 
size="5"
                autoIncrement="false"/>
        <column name="DISPLAYNAME" primaryKey="false" required="true" 
type="VARCHAR" size="200"
                autoIncrement="false"/>
    </table>

New table definition with additional primary key column INSTANCENR:

    <table name="DISPLAYNAMES">
        <column name="CLASSNAME" primaryKey="true" required="true" 
type="VARCHAR" size="200"
                autoIncrement="false"/>
        <column name="FIRMWAREID" primaryKey="true" required="true" 
type="INTEGER" size="10"
                autoIncrement="false"/>
        <column name="LANGUAGE" primaryKey="true" required="true" type="CHAR" 
size="5"
                autoIncrement="false"/>
        <column name="INSTANCENR" primaryKey="true" required="true" 
type="INTEGER" size="10"
                autoIncrement="false" default="-1"/>
        <column name="DISPLAYNAME" primaryKey="false" required="true" 
type="VARCHAR" size="1000"
                autoIncrement="false"/>
    </table>

It's a problem similar to bug DDLUTILS-159 (already resolved for Oracle, SAP DB 
and MySQL)

  was:
Primary key changes don't work with SQLServer database.
It's the same problem described in DDLUTILS-159 and already resolved for 
Oracle, SAP DB and MySQL.


> primary key column change causes exception (#2)
> -----------------------------------------------
>
>                 Key: DDLUTILS-251
>                 URL: https://issues.apache.org/jira/browse/DDLUTILS-251
>             Project: DdlUtils
>          Issue Type: Bug
>          Components: Core - SqlServer
>    Affects Versions: 1.0
>         Environment: Windows XP
>            Reporter: Stefan Huber
>            Assignee: Thomas Dudziak
>
> If you add a column to an existing primary key, database updates fails with 
> NullPointerException:
> java.lang.NullPointerException
>       at 
> org.apache.ddlutils.alteration.AddPrimaryKeyChange.apply(AddPrimaryKeyChange.java)
>       at 
> org.apache.ddlutils.platform.SqlBuilder.processChange(SqlBuilder.java)
>       at 
> org.apache.ddlutils.platform.mssql.MSSqlBuilder.processTableStructureChanges(MSSqlBuilder.java)
>       at 
> org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java)
>       at 
> org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java)
>       at 
> org.apache.ddlutils.platform.SqlBuilder.processChanges(SqlBuilder.java)
>       at 
> org.apache.ddlutils.platform.mssql.MSSqlBuilder.processChanges(MSSqlBuilder.java)
>       at 
> org.apache.ddlutils.platform.SqlBuilder.alterDatabase(SqlBuilder.java)
> Orignial table definition:
>     <table name="DISPLAYNAMES">
>         <column name="CLASSNAME" primaryKey="true" required="true" 
> type="VARCHAR" size="200"
>                 autoIncrement="false"/>
>         <column name="FIRMWAREID" primaryKey="true" required="true" 
> type="INTEGER" size="10"
>                 autoIncrement="false"/>
>         <column name="LANGUAGE" primaryKey="true" required="true" type="CHAR" 
> size="5"
>                 autoIncrement="false"/>
>         <column name="DISPLAYNAME" primaryKey="false" required="true" 
> type="VARCHAR" size="200"
>                 autoIncrement="false"/>
>     </table>
> New table definition with additional primary key column INSTANCENR:
>     <table name="DISPLAYNAMES">
>         <column name="CLASSNAME" primaryKey="true" required="true" 
> type="VARCHAR" size="200"
>                 autoIncrement="false"/>
>         <column name="FIRMWAREID" primaryKey="true" required="true" 
> type="INTEGER" size="10"
>                 autoIncrement="false"/>
>         <column name="LANGUAGE" primaryKey="true" required="true" type="CHAR" 
> size="5"
>                 autoIncrement="false"/>
>         <column name="INSTANCENR" primaryKey="true" required="true" 
> type="INTEGER" size="10"
>                 autoIncrement="false" default="-1"/>
>         <column name="DISPLAYNAME" primaryKey="false" required="true" 
> type="VARCHAR" size="1000"
>                 autoIncrement="false"/>
>     </table>
> It's a problem similar to bug DDLUTILS-159 (already resolved for Oracle, SAP 
> DB and MySQL)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to