Issue Details (XML | Word | Printable)

Key: NUCRDBMS-536
Type: Task Task
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Derby handling of composite indexes via JDBC is not well-handled

Created: 28/Jun/11 04:08 PM   Updated: 01/Aug/11 05:13 PM   Resolved: 28/Jun/11 05:41 PM
Component/s: Schema
Affects Version/s: None
Fix Version/s: 3.0.0.m6


 Description  « Hide
If we create a unique index across multiple fields, resulting in the following SQL

ALTER TABLE {tblName} ADD CONSTRAINT {constrName} UNIQUE (col1, col2, col3)

and then we call DatabaseMetaData it returns

org.datanucleus.store.rdbms.schema.IndexInfo
  tableCat =
  tableSchem = null
  tableName = FIELDMETA
  columnName = CLASSMETA_CLASSID_OID
  nonUnique = true
  ordinalPosition = 1
  indexName = SQL110628145704820
org.datanucleus.store.rdbms.schema.IndexInfo
  tableCat =
  tableSchem = null
  tableName = FIELDMETA
  columnName = OWNERFIELDMETA_FIELDID_OID
  nonUnique = true
  ordinalPosition = 2
  indexName = SQL110628145704820
org.datanucleus.store.rdbms.schema.IndexInfo
  tableCat =
  tableSchem = null
  tableName = FIELDMETA
  columnName = FIELDNAME
  nonUnique = true
  ordinalPosition = 3
  indexName = SQL110628145704820

so is returning the index as 3 rows of the result set, and as "non-unique"!

MySQL does the same except it uses the actual index name (so we can match it) and puts unique.

Andy Jefferson added a comment - 28/Jun/11 05:41 PM
Derby adapter changed to generate unique index via
CREATE UNIQUE INDEX ...

Andy Jefferson made changes - 28/Jun/11 05:41 PM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Assignee Andy Jefferson [ andy ]
Fix Version/s 3.0.0.m6 [ 11280 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 01/Aug/11 05:13 PM
Status Resolved [ 5 ] Closed [ 6 ]