Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id CAC5E633A66 for ; Fri, 5 Feb 2010 17:04:03 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 62338-03 for ; Fri, 5 Feb 2010 21:03:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f222.google.com (mail-ew0-f222.google.com [209.85.219.222]) by mail.postgresql.org (Postfix) with ESMTP id 05142632571 for ; Fri, 5 Feb 2010 17:03:50 -0400 (AST) Received: by ewy22 with SMTP id 22so89573ewy.34 for ; Fri, 05 Feb 2010 13:03:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=AVjhrm6dmFntjfZreC7aaX8+KL3dwdO9pYDeAydN+HE=; b=fCcCfjNthRdlK1ToSe7xAruLigDEp9L6JCQAFKaAge9LR4KfCEcRc8C5ML/kjTHqn5 KIO9reMu2ShBxYTtH1YRXkhUlmDJp91rrrZk8qtkAP5l+lQtj2c8qPV/3YAF2/TSvb0X lsIQ4i91GY6XSWQhdhvrWiafnnq5eFavGrpk8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=EU1xhVyMOg/ig2gHefeDy4reaaTB6+O7F6ug20UfFkIg2n+MHcsRdMVjDNuKM9xxO3 ufN6s1U5j43L4EA65xrjJMCynNq8glil8GEn9VYuzees92IfRlytc8K8KAoYF9HaS0HD AbEZP5koHIsac6gsCr/Fu/JNmE8KFgEGM5vyw= Received: by 10.213.43.132 with SMTP id w4mr996970ebe.62.1265403423436; Fri, 05 Feb 2010 12:57:03 -0800 (PST) Received: from ?0.0.0.0? (5357DA75.cable.casema.nl [83.87.218.117]) by mx.google.com with ESMTPS id 15sm1243799ewy.8.2010.02.05.12.57.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 05 Feb 2010 12:57:02 -0800 (PST) Message-ID: <4B6C8626.6080300@gmail.com> Date: Fri, 05 Feb 2010 21:57:10 +0100 From: Yeb Havinga User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Andreas CC: pgsql-sql@postgresql.org Subject: Re: Howto have a unique restraint on UPPER (textfield) References: <4B64EA46.60605@gmx.net> In-Reply-To: <4B64EA46.60605@gmx.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.181 tagged_above=-10 required=5 tests=AWL=0.419, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/31 X-Sequence-Number: 33630 Andreas wrote: > is there a way to define a unique restraint on UPPER (textfield)? > psql throws a syntax error because of the upper() function. The third section of the create index command at http://www.postgresql.org/docs/8.4/interactive/sql-createindex.html describes a function based index with as example the function .... upper! :-) postgres=# create table aap (a text); CREATE TABLE postgres=# create unique index ai on aap (upper(a)); CREATE INDEX postgres=# insert into aap values ('aap'); INSERT 0 1 postgres=# insert into aap values ('aaP'); ERROR: duplicate key value violates unique constraint "ai" regards, Yeb Havinga