Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 48037 invoked from network); 28 Jan 2010 20:57:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 Jan 2010 20:57:58 -0000 Received: (qmail 80115 invoked by uid 500); 28 Jan 2010 20:57:58 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 80071 invoked by uid 500); 28 Jan 2010 20:57:58 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 80063 invoked by uid 99); 28 Jan 2010 20:57:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jan 2010 20:57:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jan 2010 20:57:55 +0000 Received: from brutus.apache.org (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9431A234C48D for ; Thu, 28 Jan 2010 12:57:34 -0800 (PST) Message-ID: <1867890211.113061264712254605.JavaMail.jira@brutus.apache.org> Date: Thu, 28 Jan 2010 20:57:34 +0000 (UTC) From: "Dag H. Wanvik (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-991) Defining the same primary key twice on a table actually attempts to create two constraints. In-Reply-To: <313076672.1140013690928.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12806089#action_12806089 ] Dag H. Wanvik commented on DERBY-991: ------------------------------------- This issue calls for a more correct error message, as far as I can see. Primary key(i) implies unique(i), so the unique specification is, at best, redundant. It could also be a sign of a user error and if so, swallowing it silently may not be a good thing. In my view, Hibernate should not generate this code.. What do other database than MySQL do in this case, I wonder? > Defining the same primary key twice on a table actually attempts to create two constraints. > -------------------------------------------------------------------------------------------- > > Key: DERBY-991 > URL: https://issues.apache.org/jira/browse/DERBY-991 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.2.1.6 > Reporter: Daniel John Debrunner > Priority: Minor > Attachments: w.sql > > > Defining the same primary key twice on a table actually attempts to create two constraints. > ij> create table t ( i int, b int, primary key (i,b), primary key (i,b)); > ERROR 42Z93: Constraints 'SQL060215062628851' and 'SQL060215062628850' have the > same set of columns, which is not allowed. > ij> create table t ( i int primary key primary key primary key); > ERROR 42Z93: Constraints 'SQL060214082337951' and 'SQL060214082337950' have the > same set of columns, which is not allowed. > Other combinations of two primary keys (that I could think of) return the correct error. > ij> create table t ( i int, b int, primary key (i,b), primary key (b)); > ERROR 42X90: More than one primary key constraint specified for table 'T'. > ij> create table t ( i int primary key, b int primary key); > ERROR 42X90: More than one primary key constraint specified for table 'T'. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.