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 151892 - Index is not added without any error message
Summary: Index is not added without any error message
Status: RESOLVED WONTFIX
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jiri Skrivanek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-30 18:18 UTC by Roman Mostyka
Modified: 2009-06-26 13:29 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Mostyka 2008-10-30 18:18:58 UTC
1. Connect to "travel" Java DB.
2. Expand PERSON table, rightclick "Indexes" node and choose "Add Index".
3. Set any checkbox(es) and click "OK".

Result: Dialog disappears, but index isn't added and it's not clear.
Comment 1 David Vancouvering 2008-10-30 18:50:58 UTC
That's weird, I just tried it before checking in and it worked fine.  I'll try to reproduce.
Comment 2 David Vancouvering 2008-10-30 21:12:43 UTC
Works for me on the Mac.  Note that the default index name is one that already exists.  I tried it without changing the
index name and it says the index already exists.

Can you please verify with the latest build?
Comment 3 Roman Mostyka 2008-10-31 13:25:32 UTC
I tried with latest build on Windows XP and Mac OS X. The result is the same.
And actually in default "travel" Java DB, for PERSON table, suggested by default name for new index differs from
existing index.
I have one index for this table and it's name looks like "SQL070823014403450". I tried to create index with default name
"PERSON_idx" and without success and any error message.
One more point, which is probably the real reason, is that I checked only "PERSONID" checkbox for the index.
Comment 4 David Vancouvering 2008-10-31 23:37:26 UTC
OK, reproduced *when I use the primary key* as the index column.  This only happens with Java DB.  It works fine on MySQL.

I'll see what happens if I do this directly in SQL.
Comment 5 David Vancouvering 2008-11-01 00:09:58 UTC
If I try to execute this with straight SQL:

create index customer_idx on customer(customer_id);

and then refresh the table, I get the same behavior - the index appears to have been created successfully but doesn't
show up in the index list.

If I execute the same statement again, it succeeds.  I can do the same thing with any index where I'm using the same
columns for an index that already exists.

It appears Derby is making the call that "hey, this index already exists, so why bother creating it again."

I've sent an email asking that they at least tell the user that the index with those columns already exists.

I do think it's strange, actually, that MySQL lets you create multiple indexes with the same column set.  I wonder what
they do under the cover.  Do they actually maintain two separate indexes?  Or is the name just an alias?

But at this point this is a Derby "feature" and out of our hands, so closing the issue.
Comment 6 Roman Mostyka 2008-11-05 20:00:54 UTC
But customer don't understand what is going on. There is no any error message. Can we handle this?
Comment 7 David Vancouvering 2008-11-05 20:52:23 UTC
Ok, perhaps we can detect that no column was added and provide a helpful error message.  But I disagree this is a P2.
Comment 8 Jiri Rechtacek 2009-02-10 15:31:11 UTC
Reassigned to new owner.
Comment 9 Jiri Skrivanek 2009-06-26 13:29:06 UTC
It is more or less a user error to try create index for already indexed row. Then it is easy to check other indexes and
fix it. I will not add any extra warning for such situation.