From: Tom Lane <tgl@sss.pgh.pa.us>
To: kurt@kwnet.at
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13938: CAST error on Index "function must be immutable"
Date: Tue, 09 Feb 2016 12:15:54 -0500
Message-ID: <14233.1455038154@sss.pgh.pa.us> (raw)
In-Reply-To: <20160209144201.2572.15861@wrigleys.postgresql.org>
References: <20160209144201.2572.15861@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
kurt@kwnet.at writes:
> CREATE TABLE ud_data (
> val TEXT,
> );
> CREATE INDEX ud_data_FLOAT ON ud_data(CAST(val AS FLOAT)) WHERE i_type=3;
> --accepted as valid.
> CREATE INDEX ud_data_TIME ON ud_data(CAST(val AS INTERVAL)) WHERE
> i_type=10;
> --results in error "functions in index expression must be marked IMMUTABLE"
This is not a bug. The cast from text to interval isn't immutable because
its results may vary depending on the IntervalStyle setting.
> --the same error when casting to TIMESTAMP (with or without time zone)
Same, although it's DateStyle and/or TimeZone that affect this.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, kurt@kwnet.at
Subject: Re: BUG #13938: CAST error on Index "function must be immutable"
In-Reply-To: <14233.1455038154@sss.pgh.pa.us>
References: <20160209144201.2572.15861@wrigleys.postgresql.org> <14233.1455038154@sss.pgh.pa.us>
* 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