This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 151894 - Error message by attempt to add column to the index
Summary: Error message by attempt to add column to the index
Status: VERIFIED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: David Vancouvering
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-30 18:33 UTC by Roman Mostyka
Modified: 2008-10-31 13:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of error message. (13.37 KB, image/jpeg)
2008-10-30 18:33 UTC, Roman Mostyka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2008-10-30 18:33:04 UTC
1. Connect to "travel" Java DB.
2. Expand it's "Indexes" node, rightclick index and choose "Add Column".
3. Choose some column and click "OK".

Result: Error message about error on rename appears.
Comment 1 Roman Mostyka 2008-10-30 18:33:31 UTC
Created attachment 72939 [details]
Screenshot of error message.
Comment 2 David Vancouvering 2008-10-30 18:58:44 UTC
If this doesn't work, it's a P2.  Almost makes me want to remove support for this - I don't like the way we do this -
drop the old index and create a new one.  We should just make the user do it manually rather than try to do it for them.
Comment 3 David Vancouvering 2008-10-30 21:51:01 UTC
I couldn't reproduce, then I looked carefully at the error message.  You are trying to add a column to the primary key.
 But the way we add a column to an index is to drop the indx and recreate it - yuck.

You can't use 'DROP INDEX' to drop the primary key index, so that's why this fails. It actually works with Java DB, but
not really - the primary key is still declared to be for the original column, even though the new column is in the
primary key index.

There is no way to tell via JDBC metadata whether an index is the index used by the primary key or just an index that
*uses* the primary key column.  So I don't know if there's anything we can do about this unless we disabled the ability
to drop or add columns to *any* index that contains the primary key column(s).

The only thing I can think of doing is if we get an error, the message can suggest that perhaps the user was trying to
modify a primary key index.
Comment 4 David Vancouvering 2008-10-30 22:04:42 UTC
Sorry, I didn't meant to mark it as fixed just yet.  

I updated the error message to suggest that the cause may be because the primary key index can't be modified.

e24ec153ce3d
Comment 5 Quality Engineering 2008-10-31 04:46:50 UTC
Integrated into 'main-golden', will be available in build *200810310201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e24ec153ce3d
User: David Van Couvering <davidvc@netbeans.org>
Log: #151894: Error message by attempt to add column to the index
Comment 6 Roman Mostyka 2008-10-31 13:00:11 UTC
Verified with build 081031.