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

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

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #620: create index ... (date_part('year', d)) fails
Date: 2002-03-15 13:52:38
Message-ID: 20020315135238.54F0F475A5A@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
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. 


Sample Code
-- the table
create table test (d date);

-- partial indices:
create index d_year on test  (date_part('year', d));

--  fails with: ERROR:  parser: parse error at or near "'"

create index d_year on test (extract(year from d));

--  fails with: ERROR:  parser: parse error at or near "("

No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: Viacheslav N TararinDate: 2002-03-15 14:09:26
Subject:
Previous:From: 'Ben Grimm'Date: 2002-03-15 13:23:58
Subject: Re: Bug #613: Sequence values fall back to previously chec

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