Trim and case sensitivity

A couple of observations:

  1. I don’t think we enforce a trim() in all instances where we store strings in the db such as dataelement name/shortname or orgunit name/shortname. This can lead to unwanted effect like coexistence of “Port Loko” and "Port Loko " in the same database, as well as the ordering being screwed up by leading whitespace.

  2. Similarly, we seem to mostly be content with uniqueness rather than checking whether the same string already exists with a different case, e.g. potentially having “Port Loko”, “Port loko” and “PORT LOKO” as parallel different orgunits, whether they are in fact different (which they may of course be) or not.

BTW, I have found the “Proper Case” (aka Title Case) available in Access quite good in converting hundreds of upper case strings such as “PORT LOKO” to “Port Loko”. It’s a bit more trouble to do the same in Postgres:


Knut Staring

Informatics, U. of Oslo