Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6RCr-0006BB-T0 for pgsql-general@arkaria.postgresql.org; Wed, 29 Jun 2022 06:29:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o6RCq-0004VG-KG for pgsql-general@arkaria.postgresql.org; Wed, 29 Jun 2022 06:29:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6RCq-0004V7-A0 for pgsql-general@lists.postgresql.org; Wed, 29 Jun 2022 06:29:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6RCm-0007El-Vm for pgsql-general@lists.postgresql.org; Wed, 29 Jun 2022 06:29:42 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 25T6Tcqp2997975; Wed, 29 Jun 2022 02:29:38 -0400 From: Tom Lane To: Pavel Stehule cc: Bryn Llewellyn , "David G. Johnston" , Christophe Pettus , pgsql-general list Subject: Re: User's responsibility when using a chain of "immutable" functions? In-reply-to: References: <38FB5DA3-5940-43A9-8B09-5C856E2B18C4@yugabyte.com> <80C40450-6C0C-46E2-AE82-E7D46120F7FF@thebuild.com> <2987095.1656481562@sss.pgh.pa.us> Comments: In-reply-to Pavel Stehule message dated "Wed, 29 Jun 2022 08:19:02 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2997973.1656484178.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 29 Jun 2022 02:29:38 -0400 Message-ID: <2997974.1656484178@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Stehule writes: > st 29. 6. 2022 v 7:46 odesílatel Tom Lane napsal: >> ... that result has discouraged most people from spending much >> time on mechanically checking such things. If you declare a function >> immutable, Postgres will believe you; the consequences if you lied >> are on your own head. > We cannot ensure that the function is immutable, but we can detect that the > function is not very probably immutable (in execution time). Sure, there are a lot of easy cases where we could say "that's obviously not immutable". But is it worth spending engineering effort and runtime on that? I suspect the cases that people might actually mess up are less obvious, so that we might accomplish little more than offering a false sense of security. regards, tom lane