From: | Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> |
---|---|
To: | PG-General Mailing List <pgsql-general(at)postgresql(dot)org> |
Subject: | Immutable way to cast timestamp TEXT to DATE? (for index) |
Date: | 2019-01-04 22:21:42 |
Message-ID: | CAD3a31XupySutj+RGLxQrOqji5gBZo6Z05rAYgRDRH10wi4Mag@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi. I've got a text field in a table that holds this style of timestamp:
2014-10-23T00:00:00
I'd like to be able to create an index on the date portion of this field
(as a date), because I have lots of queries that are searching for
particular dates or ranges.
I've tried various ways of getting to a date (::date, LEFT(x,10)::date,
etc.), but all of them throw the error "functions in index expression must
be marked IMMUTABLE."
Is there any way, hacky or otherwise, people know of to do this? Thanks in
advance.
Ken
--
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801
Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2019-01-04 22:27:02 | Re: Immutable way to cast timestamp TEXT to DATE? (for index) |
Previous Message | Rich Shepard | 2019-01-04 22:19:07 | Re: Comparing dates in DDL |