From: Rui DeSousa <rui@crazybean.net>
To: Mark Steben <mark.steben@drivedominion.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: trying to build immutable function in index
Date: Tue, 2 Jun 2020 18:24:14 -0400
Message-ID: <E712B033-4FC4-408A-8794-E3A0AC593D18@crazybean.net> (raw)
In-Reply-To: <CADyzmywvjH8OYZTmqjS=eQMgvXScYza0NAqS2G63fJNPu=GCCw@mail.gmail.com>
References: <CADyzmywvjH8OYZTmqjS=eQMgvXScYza0NAqS2G63fJNPu=GCCw@mail.gmail.com>
> On Jun 2, 2020, at 5:42 PM, Mark Steben <mark.steben@drivedominion.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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: rui@crazybean.net, mark.steben@drivedominion.com
Subject: Re: trying to build immutable function in index
In-Reply-To: <E712B033-4FC4-408A-8794-E3A0AC593D18@crazybean.net>
References: <CADyzmywvjH8OYZTmqjS=eQMgvXScYza0NAqS2G63fJNPu=GCCw@mail.gmail.com> <E712B033-4FC4-408A-8794-E3A0AC593D18@crazybean.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox