Uploaded image for project: 'DdlUtils'
  1. DdlUtils
  2. DDLUTILS-251

primary key column change causes exception (#2)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0
    • None
    • Core - SqlServer
    • None
    • Windows XP

    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)

      Attachments

        Issue Links

          Activity

            People

              tomdz Thomas Dudziak
              s_huber Stefan Huber
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: