X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 00577529F1 for ; Fri, 8 Jul 2005 13:57:00 -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 09545-04 for ; Fri, 8 Jul 2005 16:56:57 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id E1AB152A0E for ; Fri, 8 Jul 2005 13:56:56 -0300 (ADT) Received: (qmail 10201 invoked by uid 500); 8 Jul 2005 16:57:14 -0000 Date: Fri, 8 Jul 2005 11:57:14 -0500 From: Bruno Wolff III To: Ying Lu Cc: pgsql-sql@postgresql.org Subject: Re: Index creation question for expression (col1 || '-' || col2) Message-ID: <20050708165714.GA9501@wolff.to> Mail-Followup-To: Bruno Wolff III , Ying Lu , pgsql-sql@postgresql.org References: <42CEA509.3090507@cs.concordia.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42CEA509.3090507@cs.concordia.ca> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/87 X-Sequence-Number: 22065 On Fri, Jul 08, 2005 at 12:08:41 -0400, Ying Lu wrote: > Greetings, > > A question about creating index for the following expression. > > CREATE INDEX idx_t1 ON test (col1 || '-' || col2); > > May I know is it possible and how I may create index for the expression > such as "col1 || '-' || col2" for a table please? You have already received some answers to this specific question. However, you might consider a different solution to the underlying problem. You can make a multicolumn index that for many purposes would be better than the above functional index.