Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aTBwB-00069O-Ol for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Feb 2016 17:18:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aTBwB-0006FG-BT for pgsql-bugs@arkaria.postgresql.org; Tue, 09 Feb 2016 17:18:51 +0000 Received: from makus.postgresql.org ([174.143.35.229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aTBvZ-0005Z7-Bu for pgsql-bugs@postgresql.org; Tue, 09 Feb 2016 17:18:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aTBtT-0007Zv-PC for pgsql-bugs@postgresql.org; Tue, 09 Feb 2016 17:16:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u19HFs1Z014234; Tue, 9 Feb 2016 12:15:54 -0500 From: Tom Lane To: kurt@kwnet.at cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13938: CAST error on Index "function must be immutable" In-reply-to: <20160209144201.2572.15861@wrigleys.postgresql.org> References: <20160209144201.2572.15861@wrigleys.postgresql.org> Comments: In-reply-to kurt@kwnet.at message dated "Tue, 09 Feb 2016 14:42:01 +0000" Date: Tue, 09 Feb 2016 12:15:54 -0500 Message-ID: <14233.1455038154@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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