Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 112137 - Can not add column to primary key
Can not add column to primary key
Product: db
Classification: Unclassified
Component: Code
All All
: P3 (vote)
: 6.x
Assigned To: Jiri Skrivanek
: 128754 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2007-08-07 01:13 UTC by David Vancouvering
Modified: 2009-06-19 07:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description David Vancouvering 2007-08-07 01:13:41 UTC
In DB Explorer, open Tables, and right-click on a Table, choose Add Column...

Enter in any name, and then select the primary key index (the one with the very long name if you're using Java DB), and
click the Index box.

Click OK

This fails, saying it is unable to drop the primary key index.

It should either not let you select the primary key index, or get this to work (which I don't think is possible).
Comment 1 Andrei Badea 2007-09-29 15:26:31 UTC
Looks quite tricky. Not sure it is possible to detect that an index cannot be dropped beforehand. (For Derby, it seems
indexes for primary and foreign keys cannot be dropped without dropping that constraint first.) Any ideas?

I think I'd rather suggest dropping the whole "add column to index" stuff from the Add Column. First, it doesn't work in
some cases. Second, I don't think it's that common to add new columns to an index. Third, when the user really wants
that, (s)he should manage indexes explicitly (I know I would). Fourth, when it succeeds adding the column, it doesn't
seem to maintain the column order (ascending or descending).
Comment 2 David Vancouvering 2007-10-01 05:13:58 UTC
+1 to this.  The logic behind this code was somewhat disturbing.  It first drops the index, and then re-creates it.  If
something goes wrong during the create, then the index is just *gone*.  Not what you want at all.  I agree the user
should just manage this manually by dropping and re-creating the index.
Comment 3 David Vancouvering 2008-11-12 17:43:36 UTC
Let's drop support for add column to index.
Comment 4 David Vancouvering 2008-11-12 17:46:32 UTC
*** Issue 128754 has been marked as a duplicate of this issue. ***
Comment 5 Jiri Rechtacek 2009-02-10 15:37:57 UTC
Reassigned to new owner.
Comment 6 Jiri Skrivanek 2009-06-18 14:53:08 UTC
Support for add column to index dropped.
core-main #b81adbf87149
Comment 7 Quality Engineering 2009-06-19 07:45:14 UTC
Integrated into 'main-golden', will be available in build *200906190201* on (upload may still be in progress)
User: Jiri Skrivanek <>
Log: #112137 - Drop support for add column to index.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo