Archive for the ‘PostgreSQL’ Category

How to deal with IMMUTABLE error in indexes that work with timestamps

Wednesday, March 19th, 2008

Say that in an older version of PostgreSQL you had an index like this:

  1. CREATE INDEX logTypeDay ON myLog (eventType, date_trunc(‘day’, creationTime));

and now after upgrading to 8.1+ you’re getting:
ERROR: functions in index expression must be marked IMMUTABLE