Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vInj5-00Erxo-2g for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Nov 2025 12:43:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vInj3-0067zy-26 for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Nov 2025 12:43:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vInj3-0067zq-1J for pgsql-bugs@lists.postgresql.org; Tue, 11 Nov 2025 12:43:57 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vInj1-0079pW-00 for pgsql-bugs@lists.postgresql.org; Tue, 11 Nov 2025 12:43:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description; bh=DBRxqZLn7BiEBxLhyZADB9Dpc4JLLCGVPT+VkBJ+isc=; b=tXF6Zcp0+yKLBCCIaGtMB1GorQ Irn+RwaqeC9LKQG0hS3i1O3kr5l+ypOzOmgp27WWvTi69qzPnCDgI5Cd6WeerPX601ykVaNMHE35f fYdwLJQYT3MevnEs8tHe8IBXjY/Ps1kwE92+mEXACqdqq6jSPZVbEXxankeLIVGMngfc=; Received: from depesz by depesz.com with local (Exim 4.96) (envelope-from ) id 1vIniz-00Fu9J-2p; Tue, 11 Nov 2025 13:43:53 +0100 Date: Tue, 11 Nov 2025 13:43:53 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Heikki Linnakangas Cc: PostgreSQL mailing lists Subject: Re: Functions used by index don't need to be immutable? Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Nov 11, 2025 at 02:43:18PM +0200, Heikki Linnakangas wrote: > In case of SQL functions, the immutability check can inline or "see through" > the definition and determine that the expression used in the function > doesn't contain any immutable expressions. If you modify get_tsvector, > adding a random() to it for example, then you will get the error. Ah, makes sense. Thanks a lot. Best regards, depesz