Thread: BUG #8333: Conversions from TEXT to range types are not immutable

BUG #8333: Conversions from TEXT to range types are not immutable

From
quassnoi@gmail.com
Date:
The following bug has been logged on the website:

Bug reference:      8333
Logged by:          Alex Bolenok
Email address:      quassnoi@gmail.com
PostgreSQL version: 9.2.4
Operating system:   Fedora 19
Description:

SET lc_messages TO 'en_US.UTF-8';


DROP TABLE IF EXISTS
        mytable;


CREATE TABLE
        mytable
        (
        id INT NOT NULL PRIMARY KEY,
        vtext TEXT NOT NULL,
        vrange INT8RANGE NOT NULL
        );


INSERT
INTO    mytable
SELECT  1, t, t::INT8RANGE
FROM    (
        VALUES
        ('[1, 10]')
        ) q(t);


CREATE INDEX
        ix_mytable_vrange
ON      mytable
USING   GIST (vrange);


CREATE INDEX
        ix_mytable_vtext
ON      mytable
USING   GIST ((vtext::INT8RANGE));


--


SET
DROP TABLE
psql:<stdin>:12: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit
index "mytable_pkey" for table "mytable"
CREATE TABLE
INSERT 0 1
CREATE INDEX
psql:<stdin>:30: ERROR:  functions in index expression must be marked
IMMUTABLE


--


I expected the second index to be created as well.