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.94.2) (envelope-from ) id 1upP8N-004Vv0-0Y for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Aug 2025 10:36:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1upP8M-004tdL-Cp for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Aug 2025 10:36:35 +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.94.2) (envelope-from ) id 1upP8M-004tdC-0h for pgsql-hackers@lists.postgresql.org; Fri, 22 Aug 2025 10:36:34 +0000 Received: from meesny.iki.fi ([2001:67c:2b0:1c1::201]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1upP8K-001Fyl-27 for pgsql-hackers@postgresql.org; Fri, 22 Aug 2025 10:36:34 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4c7c724fLKzySG; Fri, 22 Aug 2025 13:36:30 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1755858991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zjp4KIbf7zJthCFQzDI0cdkQyWQ2oqFTW5DZPPUKsmc=; b=cA/TKROcXFZPLnzBnnNMvouVmwPbrnGi6KWo0UHD5aT8qfKv0C+anj0ocq3C9jyIlxnog5 Z7oQ2xeMw2LUdNl0iVFVPkEtxYHx9dOVYq6PxyW8P+HkibLJjzAqe4EYf3RYUeBwCoaXqw am6ElFgPRPzGrsMLB4AcMMGf/qZT5aE= ARC-Seal: i=1; s=meesny; d=iki.fi; t=1755858991; a=rsa-sha256; cv=none; b=a9BhkmG2+UORH3AeOHu+jb/nl2SdJUNrVzqLjE4wzY9J4ZYrF+s6tY4qFd6iVmWoqR7IhM M0lgCkE1fsSFM8OCtdsE0mCjnx8ahgoUQTdm4M+NH6fHSpR6ByHpdy6bMlofmzTC8sRR1X GTSwx6CjLpsnP5zcwRUULzljEOUn4aA= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1755858991; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zjp4KIbf7zJthCFQzDI0cdkQyWQ2oqFTW5DZPPUKsmc=; b=wj4JdkJeCzBpeb7f9d/tLNMGJQeoNYf5X0++yAyge//K1UGdDqG1KO17HdDmUzrA2z2sA2 8Qe8rNfSVoOZxrhM7jZwONJqwM584EBkQ2USFVqSOBA38/7OFS4aexwfQTIF4qtEHOIBiu spCf5ySjNQIu0xHX38tTh3ZmwhTkSqk= Message-ID: <1cc5c19e-c9fd-4abe-a528-f5c60c8dab3d@iki.fi> Date: Fri, 22 Aug 2025 13:36:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: A few patches to clarify snapshot management To: Noah Misch Cc: Andres Freund , Nathan Bossart , "pgsql-hackers@postgresql.org" References: <7c56f180-b9e1-481e-8c1d-efa63de3ecbb@iki.fi> <0cc21d6a-32c4-4d34-9eeb-7a0cf6dca9e8@iki.fi> <20250809222338.cc.nmisch@google.com> <217b1d29-a4e5-4b27-8a67-bbeaa20a5609@iki.fi> <20250819001436.38.nmisch@google.com> <20250820003756.31.nmisch@google.com> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: <20250820003756.31.nmisch@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 20/08/2025 03:37, Noah Misch wrote: > On Tue, Aug 19, 2025 at 11:45:01PM +0300, Heikki Linnakangas wrote: >> How about the attached, then? It reverts the GetTransactionSnapshot() >> change. But to still catch at least some of the invalid uses of the historic >> snapshot, it adds checks to heap_beginscan() and index_beginscan(), to >> complain if they are called on a non-catalog relation with a historic >> snapshot. > >> @@ -1143,6 +1143,15 @@ heap_beginscan(Relation relation, Snapshot snapshot, >> if (!(snapshot && IsMVCCSnapshot(snapshot))) >> scan->rs_base.rs_flags &= ~SO_ALLOW_PAGEMODE; >> >> + /* Check that a historic snapshot is not used for non-catalog tables */ >> + if (snapshot && >> + IsHistoricMVCCSnapshot(snapshot) && >> + !RelationIsAccessibleInLogicalDecoding(relation)) >> + { >> + elog(ERROR, "cannot query non-catalog table \"%s\" during logical decoding", >> + RelationGetRelationName(relation)); >> + } >> + > > I feel post-beta3 is late for debut of restrictions like this. How about a > pure revert, then add those restrictions in v19? Should be s/elog/ereport/, > also. Ok, fair. I committed the revert to v18, and the revert + additional checks to master. - Heikki