Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C6105DFD7 for ; Tue, 23 Oct 2012 14:59:14 +0000 (UTC) Received: (qmail 80612 invoked by uid 500); 23 Oct 2012 14:59:14 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 80463 invoked by uid 500); 23 Oct 2012 14:59:14 -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 80384 invoked by uid 99); 23 Oct 2012 14:59:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Oct 2012 14:59:13 +0000 Date: Tue, 23 Oct 2012 14:59:13 +0000 (UTC) From: "Knut Anders Hatlen (JIRA)" To: derby-dev@db.apache.org Message-ID: <44224429.16149.1351004353405.JavaMail.jiratomcat@arcas> In-Reply-To: <1911693874.9962.1350917652313.JavaMail.jiratomcat@arcas> Subject: [jira] [Commented] (DERBY-5959) Territory-based collation is not robust against changes in the collation rules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-5959?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1348= 2379#comment-13482379 ]=20 Knut Anders Hatlen commented on DERBY-5959: ------------------------------------------- Since Derby only supports RuleBasedCollator, one solution could be to store= the rules (RuleBasedCollator.getRules()) at database-creation time, and us= e that value to reconstruct the collator on subsequent boots (using the Rul= eBasedCollator(String) constructor). This would also allow use of a databas= e with territory-based collation on a platform that doesn't support the spe= cific locale, as long as it was available on the platform where the databas= e was created. The downside of such an approach is that the database users won't automatic= ally get the benefit of fixes in the collation rules (such as the above men= tioned http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=3D6755060 bug) wh= en upgrading the JRE. Another approach may be to instruct users to drop and recreate all indexes = that contain CHAR/VARCHAR columns when switching to another JRE, but that m= ay be impractical. Also, if the user fails to do this, inconsistencies may = sneak into the database. =20 > Territory-based collation is not robust against changes in the collation = rules > -------------------------------------------------------------------------= ----- > > Key: DERBY-5959 > URL: https://issues.apache.org/jira/browse/DERBY-5959 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.10.0.0 > Reporter: Knut Anders Hatlen > > When accessing a database with territory-based collation, Derby will use = the collation rules of the collator returned by Collator.getInstance(databa= seLocale). However, there is no guarantee that those rules are consistent a= cross different JVM vendors and versions. This means that the ordering coul= d vary, and inconsistencies could sneak into the indexes. > One example is that Oracle's JDK changed the collation rules for Turkish = between Java 5 and Java 6, so if you run the following script > connect 'jdbc:derby:memory:db;territory=3Dtr_TR;collation=3DTERRITORY_BAS= ED;create=3Dtrue'; > create table t(c char(2)); > insert into t values '=C4=B1a', 'Ia', 'ia', '=C4=B0a', '=C4=B1b', 'Ib', '= ib', '=C4=B0b'; > select * from t order by c; > you'll get different results on Java 5 and on Java 6 and later. > Java 5 will order the results like this: > ij> select * from t order by c; > C =20 > ---- > =C4=B1a =20 > Ia =20 > ia =20 > =C4=B0a =20 > =C4=B1b =20 > Ib =20 > ib =20 > =C4=B0b =20 > 8 rows selected > Java 6 and later order them like this like this: > ij> select * from t order by c; > C =20 > ---- > =C4=B1a =20 > Ia =20 > =C4=B1b =20 > Ib =20 > ia =20 > =C4=B0a =20 > ib =20 > =C4=B0b =20 > 8 rows selected -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrato= rs For more information on JIRA, see: http://www.atlassian.com/software/jira