Skip site navigation (1) Skip section navigation (2)

Re: Bug #620: create index ... (date_part('year', d)) fails

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: <molitor(at)uni-bonn(dot)de>, <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Bug #620: create index ... (date_part('year', d)) fails
Date: 2002-03-15 16:27:41
Message-ID: 20020315082549.D50245-100000@megazone23.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-bugs
sszabo(at)bigpanda(dot)com

On Fri, 15 Mar 2002 pgsql-bugs(at)postgresql(dot)org wrote:

> Ernst Molitor (molitor(at)uni-bonn(dot)de) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> create index ... (date_part('year', d)) fails
>
> Long Description
> IMHO, creation of an index on a part of a date field should work,
> but it fails due to the definition of "create index ..." in gram.y.
>
> Maybe I'm wrong, but I feel that for large tables which will have to
> be analyzed per year, an index of this kind could be an advantage.

You need to make a function that is marked iscachable that returns
date_part('year', <argument>) and use that.  IIRC, functional indices
require that all of the arguments be column references.


In response to

pgsql-bugs by date

Next:From: Mikheev, VadimDate: 2002-03-15 18:36:16
Subject: Re: Bug #613: Sequence values fall back to previously chec
Previous:From: Stephan SzaboDate: 2002-03-15 16:25:32
Subject: Re: Bug #619: Not possible to specify foreign key name

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group