Re: Immutable way to cast timestamp TEXT to DATE? (for index)

Поиск
Список
Период
Сортировка
От Ken Tanzer
Тема Re: Immutable way to cast timestamp TEXT to DATE? (for index)
Дата
Msg-id CAD3a31W0naEvCV8b3r+wbfO6sPc9Ay6rnWUVgS6dYvV4RkAE5w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Immutable way to cast timestamp TEXT to DATE? (for index)  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
On Fri, Jan 4, 2019 at 2:27 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 1/4/19 2:21 PM, Ken Tanzer wrote:

> 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."

?:
'2014-10-23T00:00:00'::timestamp

Can you also show the actual index expression?


Here's a few of the ones I tried:
ag_reach=> CREATE INDEX ON export_hch_encounter_history (CAST("Service_Date" AS date));
ERROR:  functions in index expression must be marked IMMUTABLE
ag_reach=> CREATE INDEX ON export_hch_encounter_history (CAST(LEFT("Service_Date",10) AS date));
ERROR:  functions in index expression must be marked IMMUTABLE
ag_reach=> CREATE INDEX ON export_hch_encounter_history (CAST("Service_Date"::timestamp AS date));
ERROR:  functions in index expression must be marked IMMUTABLE
ag_reach=> CREATE INDEX ON export_hch_encounter_history (("Service_Date"::date));
ERROR:  functions in index expression must be marked IMMUTABLE
ag_reach=> CREATE INDEX ON export_hch_encounter_history ((LEFT("Service_Date",10)::date));
ERROR:  functions in index expression must be marked IMMUTABLE


-- 
AGENCY Software  
A Free Software data system
By and for non-profits
(253) 245-3801

learn more about AGENCY or
follow the discussion.

В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Immutable way to cast timestamp TEXT to DATE? (for index)
Следующее
От: Andrew Gierth
Дата:
Сообщение: Re: Immutable way to cast timestamp TEXT to DATE? (for index)