BUG #13938: CAST error on Index "function must be immutable" - Mailing list pgsql-bugs

From kurt@kwnet.at
Subject BUG #13938: CAST error on Index "function must be immutable"
Date
Msg-id 20160209144201.2572.15861@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #13938: CAST error on Index "function must be immutable"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13938
Logged by:          Kurt Weiß
Email address:      kurt@kwnet.at
PostgreSQL version: 9.1.14
Operating system:   linux
Description:

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"

--the same error when casting to TIMESTAMP (with or without time zone)

pgsql-bugs by date:

Previous
From: "Valeriy A."
Date:
Subject: Re: BUG #13920: pg_try_advisory_xact_lock bigint trouble
Next
From: Tom Lane
Date:
Subject: Re: BUG #13938: CAST error on Index "function must be immutable"