Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id B42664763C7 for ; Tue, 25 Jun 2002 15:21:57 -0400 (EDT) Mailbox-Line: From bruno@wolff.to Tue Jun 25 15:21:57 2002 Received: from wolff.to (wolff.to [66.92.219.49]) by postgresql.org (Postfix) with SMTP id 5C26447661C for ; Tue, 25 Jun 2002 14:40:58 -0400 (EDT) Received: (qmail 11380 invoked by uid 500); 25 Jun 2002 18:45:58 -0000 Date: Tue, 25 Jun 2002 13:45:58 -0500 From: Bruno Wolff III To: pgsql-sql@postgresql.org Subject: Re: unique index on function and column Message-ID: <20020625184558.GA11367@wolff.to> Mail-Followup-To: pgsql-sql@postgresql.org References: <20020625175828.GA11107@wolff.to> <9830.1025030116@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9830.1025030116@sss.pgh.pa.us> User-Agent: Mutt/1.3.25i X-Spam-Status: No, hits=-5.3 required=5.0 tests=IN_REP_TO,X_NOT_PRESENT version=2.30 X-Spam-Level: X-Archive-Number: 200206/337 X-Sequence-Number: 8302 On Tue, Jun 25, 2002 at 14:35:16 -0400, Tom Lane wrote: > Bruno Wolff III writes: > > Is there a simple way to do something like the following: > > create unique index inst_u_app on inst (lower(host), psport); > > > It looks like you can have an index on several columns, but not > > several functions. > > The standard answer is to make a custom function that accepts all the > columns and produces a result you can index. > > This is sort of an academic "an existence proof is good enough" answer, > but it *is* possible to get the results you want. Making it more > convenient hasn't risen to the top of anyone's to-do list. It probably isn't worth the trouble in this case. The number of rows is small and I will use a unique index without forcing a case independpent comparison. For the time being this is good enough. Thanks for confirming that I was reading the manually correctly.