Creating an index on a timestamp with time zone cast to a date-- possible?

From: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Creating an index on a timestamp with time zone cast to a date-- possible?
Date: 2021-05-24 18:19:05
Message-ID: CAOC+FBX+0=rvSsVRA8=PZAc9ccDq--c5OUiQ0WNxGzGgxh_-eA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Seems you can't do this:

create index on someschema.sometable ((modified_at::date));

If modified_at is a timestamp with a time zone:

ERROR: functions in index expression must be marked IMMUTABLE

But you can if it's a timestamp without a time zone. Anyway, any way of
casting that as to use it as an index?

--
Wells Oliver
wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2021-05-24 18:24:47 Re: Creating an index on a timestamp with time zone cast to a date-- possible?
Previous Message Don Seiler 2021-05-24 16:20:54 Re: WALWriteLocks