Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 18952 invoked from network); 12 Mar 2008 07:11:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Mar 2008 07:11:15 -0000 Received: (qmail 93988 invoked by uid 500); 12 Mar 2008 07:11:12 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 93774 invoked by uid 500); 12 Mar 2008 07:11:12 -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 93765 invoked by uid 99); 12 Mar 2008 07:11:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Mar 2008 00:11:12 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.6.21] (HELO gmp-eb-inf-1.sun.com) (192.18.6.21) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Mar 2008 07:10:33 +0000 Received: from fe-emea-10.sun.com (gmp-eb-lb-2-fe2.eu.sun.com [192.18.6.11]) by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id m2C7Aaxu019904 for ; Wed, 12 Mar 2008 07:10:42 GMT Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0JXL00A01VRVFY00@fe-emea-10.sun.com> (original mail from Jorgen.Loland@Sun.COM) for derby-dev@db.apache.org; Wed, 12 Mar 2008 07:10:36 +0000 (GMT) Received: from [129.159.112.194] by fe-emea-10.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0JXL0097JVXNP810@fe-emea-10.sun.com> for derby-dev@db.apache.org; Wed, 12 Mar 2008 07:10:36 +0000 (GMT) Date: Wed, 12 Mar 2008 08:10:35 +0100 From: =?UTF-8?B?SsO4cmdlbiBMw7hsYW5k?= Subject: Re: [jira] Commented: (DERBY-3523) sql states (X0Y63, X0Y63, X0Y63.S) related to nulls in unique constraints are associated with wrong message texts In-reply-to: <47D6C340.9050400@sbcglobal.net> Sender: Jorgen.Loland@Sun.COM To: derby-dev@db.apache.org Message-id: <47D781EB.90906@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7BIT References: <2028338883.1205255446208.JavaMail.jira@brutus> <47D6C340.9050400@sbcglobal.net> User-Agent: Thunderbird 2.0.0.12 (X11/20080228) X-Virus-Checked: Checked by ClamAV on apache.org Mike Matrigali wrote: > It does seem like the best case would be for the error message system to > somehow return a different error message for the same number if it is > in soft upgrade vs. hard upgrade. Does the error message system support > such a thing? Yes, it does. If you want multiple messages with the same SQL state, you need to add the "..<#>" information to the error state in SQLState.java. E.g, all these messages have SQL State 08004: ----- snip from SQLState.java ---- String LOGIN_FAILED = "08004"; String NET_CONNECT_AUTH_FAILED = "08004.C.1"; String NET_DATABASE_NOT_FOUND = "08004.C.2"; String AUTH_DATABASE_CONNECTION_REFUSED = "08004.C.3"; String AUTH_SHUTDOWN_NOT_DB_OWNER = "08004.C.4"; String AUTH_ENCRYPT_NOT_DB_OWNER = "08004.C.5"; ... ----- snip ------- If, e.g., both these messages '{0}' cannot be a column of a primary key or unique key because it can contain null values. '{0}' cannot be a column of a primary key because it can contain null values. ... should have the same 42831 error code, you would need something like this in the SQLState.java file: String LANG_DB2_ADD_UNIQUE_OR_PRIMARY_KEY_ON_NULL_COLS = "42831.S.1"; String LANG_DB2_ADD_PRIMARY_KEY_ON_NULL_COLS = "42831.S.2"; 'S' because 42831 is statement severity level (see class javadoc in SQLState.java), while 1 and 2 are used to tell the messages apart. messages.xml also needs to be updated, of course.