X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1A962529D1 for ; Tue, 16 Aug 2005 18:05:16 -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 02295-05 for ; Tue, 16 Aug 2005 21:05:14 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 0B2B8529C4 for ; Tue, 16 Aug 2005 18:05:13 -0300 (ADT) Received: (qmail 31990 invoked by uid 500); 16 Aug 2005 21:07:01 -0000 Date: Tue, 16 Aug 2005 16:07:01 -0500 From: Bruno Wolff III To: Chris Hoover Cc: pgsql-admin@postgresql.org Subject: Re: Is there anyway to create a functional index using to_date? Message-ID: <20050816210701.GB29260@wolff.to> Mail-Followup-To: Bruno Wolff III , Chris Hoover , pgsql-admin@postgresql.org References: <1d219a6f0508161324285f4ee6@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1d219a6f0508161324285f4ee6@mail.gmail.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200508/198 X-Sequence-Number: 18517 On Tue, Aug 16, 2005 at 16:24:37 -0400, Chris Hoover wrote: > I'm running 7.3.4 and we are having problems with our reporting views > on our database. One fix I wanted to do was to create a functional > index using the to_date function. However, when I do a create index > abc on table def(to_date(char_field,'yyyymmdd')), PostgreSQL complains > about a parser error at the 'yyyymmdd'. Is there anyway to force > PostgreSQL to create this kind of index? > > I can get it to create on if I create a special function that just > takes the field to be converted and returns the converted date. > However, I would prefer not to go that route since it requires us to > update all of our views. That is what you have to do in older versions of postgres. You don't have to do that in 8.0 (I am not sure about 7.4).