Resolve inconsistent results when invoking LOWER() in C vs. UTF8 locale databases
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 12 Mar 2011 03:14:10 +0000 (03:14 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sat, 12 Mar 2011 03:14:10 +0000 (03:14 +0000)
commit6d081fead0964b9592b5873e8e3b0a28c22a6b96
treeb035588c5ef9adf7bc9dfc254edb724c84106998
parent8725884f4603f136841f2b33edc9b64f9c950654
Resolve inconsistent results when invoking LOWER() in C vs. UTF8 locale databases

As reported by the Fundamental Science Library of Armenia, patron searches
were not retrieving patrons who were known to be part of the patron database.

While the initial approach to solve this problem used an encode_utf8() call
to encode the data before passing it on to the database, this turned out to
break the patron search function in other environments.

Testing by Dan Wells confirmed that the LOWER() function returned different
results when invoked against text in a database created with LC_CTYPE=C vs
a database created with LC_CTYPE=*.UTF-8. As the patron search function
used a Perl lc() function call to convert the incoming data to lowercase,
the success of the call depended on the LC_CTYPE value of the database.

To avoid this problem in the future, we define our own evergreen.lowercase()
function that can reliably produce lowercase text for characters outside
the Latin1 range, and we convert our indexes and function calls to use that
function consistently.

git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@19717 dcc99617-32d9-48b4-a31d-7c20da2025e4
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Open-ILS/src/perlmods/OpenILS/Reporter/SQLBuilder.pm
Open-ILS/src/perlmods/OpenILS/WWW/Reporter/transforms.pm
Open-ILS/src/sql/Pg/002.functions.general.sql [new file with mode: 0644]
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/005.schema.actors.sql
Open-ILS/src/sql/Pg/012.schema.vandelay.sql
Open-ILS/src/sql/Pg/build-db.sh
Open-ILS/src/sql/Pg/upgrade/0498.lowercase_via_perl.sql [new file with mode: 0644]