I am working with a JSON document which I receive from an external source. In this document, there is a
timestamp property which corresponds to the textual format of a
timestamp PostgreSQL data type. So in other words, it can be casted to a
I want to use that
timestamp property in an index. I tried the following:
create table t ( data jsonb ); create index on t(((data->>'timestamp')::timestamp));
I am getting:
ERROR: functions in index expression must be marked IMMUTABLE
Why is this? I understood that casting to a
timestamptz is not immutable, because of the localization configuration settings which are not static, but I can't apply that logic to a cast to
Is there still a way to cast my
timestamp property in the index here?
I am working with PostgreSQL 12, as released a few days ago.