indexing date_part - Mailing list pgsql-general

From DEV
Subject indexing date_part
Date
Msg-id E1D5qfP-0007wl-00@umpa-us.com
Whole thread Raw
Responses Re: indexing date_part  (Jeff Davis <jdavis-pgsql@empires.org>)
List pgsql-general

Hello all,

 

I am interested in setting up an index with a date_part as part of it… From what I have been able to find I need to write a function that will return the date_part that I want I have tried
CREATE FUNCTION month_idxable(date) returns date AS 'SELECT date_part('month', date) from mchistw' LANGUAGE 'SQL' WITH (iscachable);

And I get: ERROR:  parser: parse error at or near "month" at character 72

 

So what am I doing wrong and how would I include the function into an index?

 

Thank you all for all of your help!

pgsql-general by date:

Previous
From: Ragnar Hafstað
Date:
Subject: Re: Problems with pgcrypto and special characters
Next
From: "Jim C. Nasby"
Date:
Subject: Fast major-version upgrade (was: postgresql 8.0 advantages)