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 6D8D452BE9 for ; Mon, 8 Aug 2005 07:00:51 -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 28164-08 for ; Mon, 8 Aug 2005 10:00:47 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 25A7752B95 for ; Mon, 8 Aug 2005 07:00:42 -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 0AE3B41452F; Mon, 8 Aug 2005 11:00:36 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 8F80915EDA; Mon, 8 Aug 2005 10:55:21 +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 20689-08; Mon, 8 Aug 2005 10:55:18 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id C4C5715ED9; Mon, 8 Aug 2005 10:55:18 +0100 (BST) Message-ID: <42F72C06.8000000@archonet.com> Date: Mon, 08 Aug 2005 10:55:18 +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/369 X-Sequence-Number: 81777 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 have two scenarios in mind. There are workarounds for both of them, but it > would be nice if they were not necessary. > > 1. In a UNIQUE column, I would like a value of 'a' to be rejected if there > is already a value of 'A'. Workaround - create a unique index on > LOWER(col_name). > > 2. I would like WHERE col_name = 'x' and WHERE col_name LIKE 'x%' to find > 'X' and 'X1'. Workaround - WHERE LOWER(col_name) = 'x' and WHERE col_name > ILIKE 'x%'. You could define your own type if you want to go to that level of effort. Or, you could just decide only to allow upper-case values (or lower-case). -- Richard Huxton Archonet Ltd