db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stacey Brown <stacey_brow...@yahoo.com>
Subject creating an index on a column that has a UNIQUE constraint just fails silently?
Date Fri, 05 Oct 2007 20:33:16 GMT

In the section "CREATE INDEX statement" it says,

    "If a column or set of columns has a UNIQUE or PRIMARY KEY constraint on it, you can not
create an index on those columns."

I'm using derby embedded in my application. When the application starts it drops
indices and then recreates them. One of those indices was on a column that had a UNIQUE constraint,
but the CREATE INDEX statement for that column completes. When I list all the indices though,
I only find the index that backs the UNIQUE constraint. Although executing my CREATE INDEX
statement didn't throw an exception, it didn't create the index.

I'm not trying to argue anything here and I'm not claiming expertise, but when I read "you
can not create an index on those columns" I thought that I would get an exception if I attempted
to create an index on a column that has a UNIQUE or PRIMARY KEY constraint.

My question is whether the behavior is intentional or not. Should I have gotten an exception
when I executed a CREATE INDEX statement on a column that already had a UNIQUE constraint
on it?

Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories
at Yahoo! Games.

View raw message