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 1q9nlt-0007Ip-2O for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Jun 2023 14:16:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q9nlr-0004Ok-Oe for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Jun 2023 14:16:19 +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 1q9nlr-0004Oa-FR for pgsql-hackers@lists.postgresql.org; Thu, 15 Jun 2023 14:16:19 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q9nlo-002XuS-Ud for pgsql-hackers@lists.postgresql.org; Thu, 15 Jun 2023 14:16:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=MhgLLNrdA6xOxkP2LU3LtE5r5M1knHfS/eryhVvGqcE=; b=jxISqdTZNT0M7P6XUvMxiBA4tC zvzeXIh/JSA1tptbIXQj0iOy1BRThHEAClJErIVgVDMtgj4Id3JCJUPn6MJnok8JDv8sc0NeTvShw SA0rFlDk4SohP9lT6rM/aFRuybr6qASs+JMxbpdA13NRfrtp/qfeimiBK1/1FvdeTtTSB8qCrzlL+ rVlfDor+9MXTTkYJLUmamiEbj5X6HmQNeT+UCi1Rccj6Yq6Ecxk2FyR7WH2vLTRdMDAtUXGrRFVfT 5QBwHZ3508ZZnDRCM0I7eXgEj6+RpgNh3JQ1fqHATUQoO9bPiu2uccwgvQr0dW/87aGY8NsTz5UrR evqXQ35g==; Received: from [::1] (port=45678 helo=bay.acenet.us) by bay.acenet.us with esmtpa (Exim 4.96) (envelope-from ) id 1q9nll-0098Bp-2d; Thu, 15 Jun 2023 10:16:14 -0400 MIME-Version: 1.0 Date: Thu, 15 Jun 2023 10:16:12 -0400 From: chap@anastigmatix.net To: Tom Lane Cc: Yura Sokolov , pgsql-hackers@lists.postgresql.org Subject: Re: When IMMUTABLE is not. In-Reply-To: <69234e25e34e68425f49630f79ef9991@anastigmatix.net> References: <389c986d-fbb4-c644-9280-db7836af7ca9@postgrespro.ru> <2111925.1686835298@sss.pgh.pa.us> <69234e25e34e68425f49630f79ef9991@anastigmatix.net> User-Agent: Roundcube Webmail/1.6.0 Message-ID: <4c32f84bc097dee0081e4cc3e733ef8d@anastigmatix.net> X-Sender: chap@anastigmatix.net Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-06-15 09:58, chap@anastigmatix.net wrote: > also influences what snapshot the > function is looking at, and therefore what it can see, which has > also struck me more as a tacked-on effect than something inherent > in the declaration's meaning. I just re-read that and realized I should anticipate the obvious response "but how can it matter what the function can see, if it's IMMUTABLE and depends on no data?". So, I ran into the effect while working on PL/Java, where the code of a function isn't all found in pg_proc.prosrc; that just indicates what code has to be fetched from sqlj.jar_entry. So one could take a strict view that "no PL/Java function should ever be marked IMMUTABLE" because every one depends on fetching something (once, at least). But on the other hand, it would seem punctilious to say that f(int x, int y) { return x + y; } isn't IMMUTABLE, only because it depends on a fetch /of its own implementation/, and overall its behavior is better described by marking it IMMUTABLE. Regards, -Chap