Return-Path: Delivered-To: apmail-db-ddlutils-dev-archive@www.apache.org Received: (qmail 30338 invoked from network); 8 Mar 2007 06:32:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Mar 2007 06:32:46 -0000 Received: (qmail 9493 invoked by uid 500); 8 Mar 2007 06:32:54 -0000 Delivered-To: apmail-db-ddlutils-dev-archive@db.apache.org Received: (qmail 9460 invoked by uid 500); 8 Mar 2007 06:32:54 -0000 Mailing-List: contact ddlutils-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ddlutils-dev@db.apache.org Delivered-To: mailing list ddlutils-dev@db.apache.org Received: (qmail 9399 invoked by uid 99); 8 Mar 2007 06:32:54 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2007 22:32:54 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Mar 2007 22:32:45 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 181BC714077 for ; Wed, 7 Mar 2007 22:32:25 -0800 (PST) Message-ID: <21264073.1173335545095.JavaMail.root@brutus> Date: Wed, 7 Mar 2007 22:32:25 -0800 (PST) From: "Thomas Dudziak (JIRA)" To: ddlutils-dev@db.apache.org Subject: [jira] Updated: (DDLUTILS-159) primary key column change causes exception In-Reply-To: <29308022.1172675517220.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DDLUTILS-159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Thomas Dudziak updated DDLUTILS-159: ------------------------------------ Fix Version/s: 1.0 > primary key column change causes exception > ------------------------------------------ > > Key: DDLUTILS-159 > URL: https://issues.apache.org/jira/browse/DDLUTILS-159 > Project: DdlUtils > Issue Type: Bug > Components: Core (No specific database) > Environment: Windows, SapDB 7.4 and Oracle 8 > Reporter: Stefan Huber > Assigned To: Thomas Dudziak > Fix For: 1.0 > > > I have the folowing table definition: > > > > > > >
>
> I want to change the name of the primary key column. The new schema definition is: > > > > > > >
>
> DdlUtils throws the following exception in the alter table process: > Exception in thread "main" java.lang.NullPointerException > at org.apache.ddlutils.alteration.AddPrimaryKeyChange.apply(AddPrimaryKeyChange.java:69) > at org.apache.ddlutils.platform.SqlBuilder.processChange(SqlBuilder.java:1160) > at org.apache.ddlutils.platform.sapdb.SapDbBuilder.processTableStructureChanges(SapDbBuilder.java:180) > at org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java:921) > at org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java:797) > at org.apache.ddlutils.platform.SqlBuilder.processChanges(SqlBuilder.java:576) > at org.apache.ddlutils.platform.SqlBuilder.alterDatabase(SqlBuilder.java:469) > at org.apache.ddlutils.platform.PlatformImplBase.getAlterTablesSql(PlatformImplBase.java:756) > The reason is, that an alteration of the table name is not supported via 'alter table' so DdlUtils recreates the table. But in 'SapDbBuilder.processTableStructureChanges' the new primary key is created before the table is recreated in the super-Method. So 'AddPrimaryKeyChange refers to a column that is not present and throws an exception. > The behaviour is the same with Oracle: > Exception in thread "main" java.lang.NullPointerException > at org.apache.ddlutils.alteration.AddPrimaryKeyChange.apply(AddPrimaryKeyChange.java:69) > at org.apache.ddlutils.platform.SqlBuilder.processChange(SqlBuilder.java:1160) > at org.apache.ddlutils.platform.oracle.Oracle8Builder.processTableStructureChanges(Oracle8Builder.java:488) > at org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java:921) > at org.apache.ddlutils.platform.SqlBuilder.processTableStructureChanges(SqlBuilder.java:797) > at org.apache.ddlutils.platform.SqlBuilder.processChanges(SqlBuilder.java:576) > at org.apache.ddlutils.platform.SqlBuilder.alterDatabase(SqlBuilder.java:469) > at org.apache.ddlutils.platform.PlatformImplBase.getAlterTablesSql(PlatformImplBase.java:756) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.