You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firebird does not seem to allow the creation of ICU-based collations whose locales contain keywords, such as de@collation=phonebook or de-u-co-phonebk.
For example, executing the following statement:
CREATE COLLATION UNICODE_TEST FOR UTF8 FROM UNICODE
PAD SPACE
CASE SENSITIVE
ACCENT SENSITIVE
'LOCALE=de-u-co-phonebk-ka-shifted';
fails with:
Message: isc_dsql_execute2 failed
SQL Message : -607
This operation is not defined for system tables.
Engine Code : 335544351
Engine Message :
unsuccessful metadata update
CREATE COLLATION UNICODE_TEST failed
Invalid collation attributes
The failure originates from UnicodeUtil::Utf16Collation::loadICU() (file src/common/unicode_util.cpp). When checking the incoming locale, it is compared against the locale names obtained from ICU's enumeration. This however does not include keywords or collation subtypes, so anything other than locale base names will fail this test.
I'm attaching a patch with a suggested fix (against v4.0-release, but should work on FB3 also). The fix adds a fallback check which tries to create a collator with the locale in question. This check is only performed if the previous check failed. With this modification, locales with keywords are accepted when creating a collation, and the collation works as expected when applied to a table column.
…6903) (#6914)
* Allow keywords in locales when creating ICU collations
* Change ICU locale creation check to fail for any warning.
Co-authored-by: Thomas Keinz <thomas.keinz@hescom.de>
…6903) (#6914)
* Allow keywords in locales when creating ICU collations
* Change ICU locale creation check to fail for any warning.
Co-authored-by: Thomas Keinz <thomas.keinz@hescom.de>
Firebird does not seem to allow the creation of ICU-based collations whose locales contain keywords, such as
de@collation=phonebook
orde-u-co-phonebk
.For example, executing the following statement:
fails with:
The failure originates from
UnicodeUtil::Utf16Collation::loadICU()
(filesrc/common/unicode_util.cpp
). When checking the incoming locale, it is compared against the locale names obtained from ICU's enumeration. This however does not include keywords or collation subtypes, so anything other than locale base names will fail this test.I'm attaching a patch with a suggested fix (against v4.0-release, but should work on FB3 also). The fix adds a fallback check which tries to create a collator with the locale in question. This check is only performed if the previous check failed. With this modification, locales with keywords are accepted when creating a collation, and the collation works as expected when applied to a table column.
allow_keyword_locales.zip
The text was updated successfully, but these errors were encountered: