db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mo Maison <momai...@yahoo.fr>
Subject Unique index not visible in DatabaseMetaData
Date Sun, 23 Dec 2012 21:33:29 GMT

Hello Derby users,

I detected a strange behaviour, where indices created by uniques
constraints are not reported in DatabaseMedata.getIndexInfo() :

  *getIndexInfo*(String  <http://docs.oracle.com/javase/6/docs/api/java/lang/String.html>
               String  <http://docs.oracle.com/javase/6/docs/api/java/lang/String.html>
               String  <http://docs.oracle.com/javase/6/docs/api/java/lang/String.html>
               boolean unique,
               boolean approximate)

I tested this with the simple table and two indices (one
auto-generated, and one user index) :
   create table APP.T1 ( f1 integer unique, f2 integer )
   create index index_on_f2 on t1(f2)

if called with unique=true, no index is returned.
If called with unique = false, two indices are returned :
   Index : INDEX_ON_F2  NON_UNIQUE=true
   Index : SQL121222192458030  NON_UNIQUE=true
both with column NON_UNIQUE=true, which surprises me.
Is that expected ?
Problem occurs for unnamed and named constraints.
However IIRC I saw also some indices returned by
getIndexInfo(unique = true ) on much complex database,
thus this behaviour does not seem to be always reproductible.

I use Derby client (also, open jdk 1.7 and
oracle jdk on 32 and 64bits linux machines.
I have searched into derby bug database, but could not find
any open bug on this topic (3346 is closed).

   M. Maison

View raw message