From derby-user-return-13736-apmail-db-derby-user-archive=db.apache.org@db.apache.org Tue Jun 28 14:27:51 2011 Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 09A046256 for ; Tue, 28 Jun 2011 14:27:51 +0000 (UTC) Received: (qmail 86257 invoked by uid 500); 28 Jun 2011 14:27:50 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 86206 invoked by uid 500); 28 Jun 2011 14:27:50 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 86199 invoked by uid 99); 28 Jun 2011 14:27:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jun 2011 14:27:49 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [212.159.7.35] (HELO relay.ptn-ipout01.plus.net) (212.159.7.35) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Jun 2011 14:27:41 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjgHAELjCU5UXeb6/2dsb2JhbABSmE+OcneIeaFvn1uCP4NxBJZ+izQ Received: from outmx05.plus.net ([84.93.230.250]) by relay.ptn-ipout01.plus.net with ESMTP; 28 Jun 2011 15:27:20 +0100 Received: from [87.113.245.162] (helo=rookie.persistability.co.uk) by outmx05.plus.net with esmtp (Exim) id 1QbZG4-00070T-1X for derby-user@db.apache.org; Tue, 28 Jun 2011 15:27:20 +0100 From: Andy Jefferson To: derby-user@db.apache.org Subject: DatabaseMetaData.getIndexInfo() to get unique compound indexes Date: Tue, 28 Jun 2011 15:27:18 +0100 User-Agent: KMail/1.12.4 (Linux/2.6.31.13-desktop-1mnb; KDE/4.3.5; i686; ; ) Organization: DataNucleus MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201106281527.18313.lists@datanucleus.org> If I create a unique index like this ALTER TABLE {tblName} ADD CONSTRAINT {constrName} UNIQUE (col1, col2, col3) and then call DatabaseMetaData.getIndexInfo() it returns tableCat = tableSchem = null tableName = tblName columnName = col1 nonUnique = true ordinalPosition = 1 indexName = SQL110628145704820 tableCat = tableSchem = null tableName = tblName columnName = col2 nonUnique = true ordinalPosition = 2 indexName = SQL110628145704820 tableCat = tableSchem = null tableName = tblName columnName = col3 nonUnique = true ordinalPosition = 3 indexName = SQL110628145704820 So I can work out that I have a compound index here ... since all have this weird name. But I can't work out that it is UNIQUE. Questions : 1. How do I get to know that these are parts of "constrName" ... rather than "SQLxxxxxxxx" ? 2. How do I get to know that they are part of a UNIQUE ? TIA -- Andy