X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9D31052918 for ; Tue, 9 Aug 2005 08:46:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37691-04 for ; Tue, 9 Aug 2005 11:46:32 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 3C68852854 for ; Tue, 9 Aug 2005 08:46:31 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 26140416F0A; Tue, 9 Aug 2005 12:45:59 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id DB5AC15EDA; Tue, 9 Aug 2005 12:38:58 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 31700-09; Tue, 9 Aug 2005 12:38:53 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 09E0F15ED9; Tue, 9 Aug 2005 12:38:52 +0100 (BST) Message-ID: <42F895CC.3070705@archonet.com> Date: Tue, 09 Aug 2005 12:38:52 +0100 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Frank Millman Cc: pgsql-general@postgresql.org Subject: Re: Case sensitivity References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.058 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200508/415 X-Sequence-Number: 81823 Frank Millman wrote: > Frank Millman wrote: > > >>Hi all >> >>Is there an LC_COLLATE setting, or any other method, which allows all >>data in a database to be treated in a case-insensitive manner? > > > I was hoping to stimulate some discussion on this topic, but it seems I will > have to kick-start it myself and see if anyone responds. > > My area of interest is general accounting/business systems, using a typical > Western character set. I would imagine that this is a common scenario, but > it is not universal, so read my comments in this context. > > In the good old days, data entry was always done in upper case, by dedicated > data entry personnel. These days, it is typically done by a wide variety of > individuals, who carry out a wide range of tasks, most of which require > lower case (word processing, email) with the occasional use of the shift key > to enter a capital letter. > > In this context, here are two undesirable effects. Martijn has pointed to a case-insensitive type, but I'll add a couple of points. > 1. The user tries to call up account 'A001', but they enter 'a001'. First > problem, the system does not find the account. Second problem, the system > allows them to create a new account with the code 'a001'. Now you have > 'A001' and 'a001'. This is a recipe for chaos. The basic problem here is that the value isn't text. This is partly the fault of development-systems not having a way to deal with sophisticated types in databases. What should happen is that you define some suitable type "AccountCode" which is defined as allowing character data in the form of (e.g.) "[A-Z][0-9][0-9][0-9]". That type can cast to/from text but doesn't need access to the full range of text-handling functions (e.g. concatenating two account-codes is probably meaningless). Of course, you want to define this in one place and have both the database constraints and user-interface understand what you want. Ironically, MS-Access does this quite well with its tight coupling of user-interface and data storage. > 2. The user tries to call up a product item using a search string on the > description. Assume they enter 'Wheel nut'. Assume further that the person > who created the product item used the description 'Wheel Nut'. Try > explaining to the user why the system cannot find the item they are looking > for. Here, I'm not convinced a case-insensitive type is any more useful than just using ILIKE. -- Richard Huxton Archonet Ltd