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 1pS3T4-0003zN-Ma for pgsql-jdbc-commits@arkaria.postgresql.org; Tue, 14 Feb 2023 22:08:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pS3T2-0007a3-TC for pgsql-jdbc-commits@arkaria.postgresql.org; Tue, 14 Feb 2023 22:08:04 +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 1pS1D9-0003On-8q; Tue, 14 Feb 2023 19:43:31 +0000 Received: from out-23.smtp.github.com ([192.30.252.206]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pS1D4-0002kz-Kg; Tue, 14 Feb 2023 19:43:30 +0000 Received: from github.com (hubbernetes-node-33663a7.ac4-iad.github.net [10.52.222.42]) by smtp.github.com (Postfix) with ESMTPA id DFE9D600497; Tue, 14 Feb 2023 11:43:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1676403804; bh=ehAisvJEacMM0BJyOfdnqCBSit3c+MBmOlYW3PCrIvs=; h=Date:From:To:Subject:From; b=Ti9yLJFDKSIFaF2RlShrRIAP/hw1fPNlVurp/WIzCh9kJRLxoZT647KSYDlCzhnh5 pXQAQCpUcSiJi9Xhebcpd53Ngg9ai4iAPSS0x4CjJATr/rkzTldceOGdboZIMYDIkR rHgID+4uDIgPwVqnXGLL7RoE0kbWg6dZgCrUd9yk= Date: Tue, 14 Feb 2023 11:43:24 -0800 From: Rafi Shamim To: pgsql-jdbc@lists.postgresql.org, pgsql-jdbc-commits@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] 248b2e: fix: Update function volatility in SchemaTest setu... Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc@lists.postgresql.org,pgsql-jdbc-commits@lists.postgresql.org X-Auto-Response-Suppress: All List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: 248b2eec547f3411d17c37814165cb1cef9daa85 https://github.com/pgjdbc/pgjdbc/commit/248b2eec547f3411d17c37814165cb1cef9daa85 Author: Rafi Shamim Date: 2023-02-14 (Tue, 14 Feb 2023) Changed paths: M pgjdbc/src/test/java/org/postgresql/test/jdbc4/jdbc41/SchemaTest.java Log Message: ----------- fix: Update function volatility in SchemaTest setup (#2806) PostgreSQL allows you to label a function as immutable even if it is not. But this can lead to non-deterministic results. See: https://www.postgresql.org/docs/current/sql-createfunction.html ``` IMMUTABLE indicates that the function cannot modify the database and always returns the same result when given the same argument values; that is, it does not do database lookups or otherwise use information not directly present in its argument list. If this option is given, any call of the function with all-constant arguments can be immediately replaced with the function value. ``` And: https://www.postgresql.org/docs/current/xfunc-volatility.html ``` Labeling a function IMMUTABLE when it really isn't might allow it to be prematurely folded to a constant during planning, resulting in a stale value being re-used during subsequent uses of the plan. This is a hazard when using prepared statements or when using function languages that cache plans (such as PL/pgSQL). ... It is generally unwise to select from database tables within an IMMUTABLE function at all, since the immutability will be broken if the table contents ever change. However, PostgreSQL does not enforce that you do not do that. ```