You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Vemund Ostgaard <Ve...@Sun.COM> on 2008/01/14 14:12:33 UTC

Setting collation=TERRITORY_BASED when territory is set to an unsupported locale

A problem I've discovered when testing with the phoneME advanced 
platform is that the collationtests expect other locales than Locale.US 
to be available on the platform that is used for the test, and for 
phoneME advanced (when compiled as foundation profile) only Locale.US is 
available. From the jdk1.6 javadoc of Collator.getAvailableLocales() I 
see that only Locale.US is strictly required:

public static Locale <http://java.sun.com/javase/6/docs/api/java/util/Locale.html>[] *getAvailableLocales*()

    Returns an array of all locales for which the |getInstance| methods
    of this class can return localized instances. The returned array
    represents the union of locales supported by the Java runtime and by
    installed |CollatorProvider|
    <http://java.sun.com/javase/6/docs/api/java/text/spi/CollatorProvider.html>
    implementations. It must contain at least a Locale instance equal to
    |Locale.US|
    <http://java.sun.com/javase/6/docs/api/java/util/Locale.html#US>.

    *Returns:*
        An array of locales for which localized |Collator| instances are
        available.


My thought on this is to change the collationtests to check if for 
instance a Collator for polish locale is available before running the 
test for polish collation.

This however led me to thinking about how Derby should behave if 
created/booted with collation=TERRITORY_BASED and territory=<some 
unsupported locale>. I'm not sure what the consequences could be if the 
database is first created on a platform that supports whatever locale is 
set and later booted with one that doesn't, or created on a platform 
missing support and later booted with one that has. In any case I think 
it may confuse a user needlessly to see the database boot successfully 
with his collation setting and later behave in a way he does not expect.

So, should database creation/boot fail if the collation is territory 
based and the locale is not supported?

Vemund


Re: Setting collation=TERRITORY_BASED when territory is set to an unsupported locale

Posted by Vemund Ostgaard <Ve...@Sun.COM>.
Thank you for sharing your opinions, Knut and Mamta. I''ve reported this 
in Jira as DERBY-3320.

Vemund

Mamta Satoor wrote:
> I think that we should fail at both database creation time and boot
> time if the requested locale can not be found when collation is
> territory based.
>
> Mamta
>
> On 1/14/08, Knut Anders Hatlen <Kn...@sun.com> wrote:
>   
>> Vemund Ostgaard <Ve...@Sun.COM> writes:
>>
>>     
>>> So, should database creation/boot fail if the collation is territory
>>> based and the locale is not supported?
>>>       
>> That sounds reasonable to me. If the Java runtime silently uses en_US
>> collators when the database's territory is something different, I think
>> we can see a variety of problems if the database is moved between
>> systems that support collators for the database's territory and systems
>> that don't. For instance, the index entries may appear to be unordered
>> and queries that use indices may give strange results.
>>
>> I think at least database boot should fail when collation is territory
>> based and locale isn't supported. For database creation we could
>> alternatively detect that the situation has occurred, change the
>> collation to UCS_BASIC before the database is created, and add a warning
>> explaining what has happened. But I think failing is the best option for
>> creation too.
>>
>> --
>> Knut Anders
>>
>>     


Re: Setting collation=TERRITORY_BASED when territory is set to an unsupported locale

Posted by Mamta Satoor <ms...@gmail.com>.
I think that we should fail at both database creation time and boot
time if the requested locale can not be found when collation is
territory based.

Mamta

On 1/14/08, Knut Anders Hatlen <Kn...@sun.com> wrote:
> Vemund Ostgaard <Ve...@Sun.COM> writes:
>
> > So, should database creation/boot fail if the collation is territory
> > based and the locale is not supported?
>
> That sounds reasonable to me. If the Java runtime silently uses en_US
> collators when the database's territory is something different, I think
> we can see a variety of problems if the database is moved between
> systems that support collators for the database's territory and systems
> that don't. For instance, the index entries may appear to be unordered
> and queries that use indices may give strange results.
>
> I think at least database boot should fail when collation is territory
> based and locale isn't supported. For database creation we could
> alternatively detect that the situation has occurred, change the
> collation to UCS_BASIC before the database is created, and add a warning
> explaining what has happened. But I think failing is the best option for
> creation too.
>
> --
> Knut Anders
>

Re: Setting collation=TERRITORY_BASED when territory is set to an unsupported locale

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Vemund Ostgaard <Ve...@Sun.COM> writes:

> So, should database creation/boot fail if the collation is territory
> based and the locale is not supported?

That sounds reasonable to me. If the Java runtime silently uses en_US
collators when the database's territory is something different, I think
we can see a variety of problems if the database is moved between
systems that support collators for the database's territory and systems
that don't. For instance, the index entries may appear to be unordered
and queries that use indices may give strange results.

I think at least database boot should fail when collation is territory
based and locale isn't supported. For database creation we could
alternatively detect that the situation has occurred, change the
collation to UCS_BASIC before the database is created, and add a warning
explaining what has happened. But I think failing is the best option for
creation too.

-- 
Knut Anders