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 1wB96q-000mY6-29 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Apr 2026 10:29:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wB96p-00BFvr-04 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Apr 2026 10:29:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wB96o-00BFvi-2B for pgsql-hackers@lists.postgresql.org; Fri, 10 Apr 2026 10:29:07 +0000 Received: from udcm-wwu2.uni-muenster.de ([128.176.118.28]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wB96m-00000000JgK-336I for pgsql-hackers@postgresql.org; Fri, 10 Apr 2026 10:29:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=uni-muenster.de; i=@uni-muenster.de; q=dns/txt; s=uniout; t=1775816945; x=1807352945; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=upBDLIZIfBl6DEGjzb7O3v9+NSl8XQwsuMO9xGjhbIg=; b=kDrbW4ZnrWp7BKcZzJY3AHApuj54zsFlmiiMpJRui2HqfxcS3IGLDRiF Vlicw8u5xdon515GYkdJaqGWXr5+dnYph6uYRqqW2OQ2jMSW1WyEnNSMp hW5adz3KXSFQzsZMCj9cmbxBsEJG73Ii5bmZ81NI2+E6tFjz+FKAypoDE 9TSn6BrIFMokOgvKnu0GvSudRKOyKiU3M3aDHtthEUpNWeEJ1T1wfXM7q +JTJq1aSw3fhhpun/DO53EzlxXf27IeCE0GcQtUki13LtF4iymfI0x+9+ eIrtQYGIeOgNbQAtDkG7hSFIQTi72COzpW3VZK48PCGzQeL9vHFOolEfJ Q==; X-CSE-ConnectionGUID: 0Jv7jUlFRCGnj+XSt69yMQ== X-CSE-MsgGUID: zRzsPloESiSkvO7ZTssEhw== X-IronPort-AV: E=Sophos;i="6.23,171,1770591600"; d="scan'208";a="390260733" Received: from secmail.uni-muenster.de ([128.176.118.4]) by UDCM-RELAY2.UNI-MUENSTER.DE with ESMTP; 10 Apr 2026 12:29:01 +0200 Received: from [192.168.178.27] (dynamic-093-133-101-031.93.133.pool.telefonica.de [93.133.101.31]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTPSA id 707C320ADF0E; Fri, 10 Apr 2026 12:29:00 +0200 (CEST) Message-ID: <086c2108-0d46-4711-82df-19eb06a55326@uni-muenster.de> Date: Fri, 10 Apr 2026 12:28:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Fix bug with accessing to temporary tables of other sessions To: Daniil Davydov <3danissimo@gmail.com> Cc: Soumya S Murali , Tom Lane , Stepan Neretin , PostgreSQL Hackers References: <1a32fc83-df78-4774-97dc-2bb06dbb16e9@uni-muenster.de> <3529398.1774273446@sss.pgh.pa.us> <4075754.1774378690@sss.pgh.pa.us> <67637cf8-8cbf-4f86-8775-52aa0329972d@uni-muenster.de> <402bbc8d-728b-4467-8024-31c2bc101ead@uni-muenster.de> Content-Language: de-DE, en-GB From: Jim Jones In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Daniil On 10/04/2026 09:10, Daniil Davydov wrote: > Having both checks might look a bit redundant since the read stream will > eventually call the StartReadBuffersImpl function. On the other hand, there are > many places which are checking this restriction even if subsequent functions > (from bufmgr) also have this check. > > So, I'll keep both checks and a bit reduce the comments in the bufmgr.c . Putting this check a level deeper sounds good to me. > BTW, what do you think about making this comment less "concrete"? : > # SELECT via index scan from other session. > # Sequential scans are blocked at read_stream_begin_relation(); index scans > # bypass that path entirely and reach ReadBufferExtended() in bufmgr.c > # (nbtree's _bt_getbuf calls ReadBuffer directly for individual page fetches). > # enable_seqscan=off forces the planner to use the index. > > I mean that if the described logic changes, this comment will become confusing. > We can describe the test in general words. For example : > # Index scans can use a different code path from the one sequential scans are > # following. Make sure that we cannot access other sessions' temp tables during > # index scan either. +1 Yeah, it's indeed too verbose. I guess these comments were originally just for me so I wouldn't get too confused along the way :) I don't have anything else to add at this point. Unless there are any objections, I'll mark the CF entry as 'Ready for Committer.' Thanks! Best, Jim