I am trying to create below index in Azure PostgreSQL Flexible Server (PostgreSQL version 14) with admin user
CREATE INDEX index_name ON table_name USING btree (to_char(columnname, 'YYYYMM'::text));
NOTE - Column data type in table is timestamptz.
It is showing me error as : SQL Error [42P17]: ERROR: functions in index expression must be marked IMMUTABLE
When I tried to alter the function to immutable with command - alter function to_char(timestamp with time zone, text) IMMUTABLE;
it is showing error as "SQL Error [42501]: ERROR: must be owner of function to_char",
The same above scenario I am able to execute without any issues in Azure PostgreSQL Single Server (PostgreSQL version 11).
Can anyone guide me on how to achieve this in Azure PostgreSQL Flexible Server (PostgreSQL version 14) ?