Re: trying to build immutable function in index

From: Rui DeSousa <rui(at)crazybean(dot)net>
To: Mark Steben <mark(dot)steben(at)drivedominion(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: trying to build immutable function in index
Date: 2020-06-02 22:24:14
Message-ID: E712B033-4FC4-408A-8794-E3A0AC593D18@crazybean.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On Jun 2, 2020, at 5:42 PM, Mark Steben <mark(dot)steben(at)drivedominion(dot)com> wrote:
>
> AND value::date >= date_trunc('MONTH'::text, 'now'::text::date - '1 mon'::interval month)

I don’t think value::date is immutable; it will return a different date depending on your timezone.

Also this is also not immutable: 'now'::text::date - '1 mon'::interval month

You would have records indexed that should not be indexed the next month basically invalidating itself each month.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2020-06-02 22:57:14 Re: trying to build immutable function in index
Previous Message Mark Steben 2020-06-02 21:42:05 trying to build immutable function in index