Return-Path: Delivered-To: apmail-db-ddlutils-dev-archive@www.apache.org Received: (qmail 63047 invoked from network); 28 Feb 2007 15:12:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Feb 2007 15:12:18 -0000 Received: (qmail 26413 invoked by uid 500); 28 Feb 2007 15:12:27 -0000 Delivered-To: apmail-db-ddlutils-dev-archive@db.apache.org Received: (qmail 26383 invoked by uid 500); 28 Feb 2007 15:12:26 -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 26356 invoked by uid 99); 28 Feb 2007 15:12:26 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Feb 2007 07:12:26 -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, 28 Feb 2007 07:12:17 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 368B8714047 for ; Wed, 28 Feb 2007 07:11:57 -0800 (PST) Message-ID: <29308022.1172675517220.JavaMail.jira@brutus> Date: Wed, 28 Feb 2007 07:11:57 -0800 (PST) From: "Stefan Huber (JIRA)" To: ddlutils-dev@db.apache.org Subject: [jira] Created: (DDLUTILS-159) primary key column change causes exception MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 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.