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 1wFKjG-004zF0-2H for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 23:42:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFKjF-00Ao2V-25 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 23:42:05 +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.96) (envelope-from ) id 1wFKjE-00Ao2M-1w for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2026 23:42:05 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wFKjB-00000002NiQ-26q6 for pgsql-hackers@postgresql.org; Tue, 21 Apr 2026 23:42:04 +0000 Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id BADF81D00051; Tue, 21 Apr 2026 19:41:57 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Tue, 21 Apr 2026 19:41:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1776814917; x=1776901317; bh=ysdmAW6yl9 jmU8VfHSGlMuTK/YUzR7AYXc8YWLrpFLk=; b=IqvUDZeSMuWdKFjpZvstAyKipM cAUXLsn1DMQ2Xx73UuppDIa8i4VvtgdB+JscdVOzOR6RNmyz/1TAaPoZV24f0mEk e4XgK45UpuX7n0jXROxuL0CYD52YG7p1d3izAxwosY6yyL6c1VYbYsj1rIM2yFMG NfZoUD214GhK5PFZInFo9DLV6mQXCAp5tYj721dP3o5dfdTNb0ZYwntbd+V3GktU QVDP1lrsQ8S6oaGeBcTpY4EKAgmcULtTa+6FIxkfjJ2SaPcwLL72bkZFECFD8UyZ QDoIjjWfLf5CSbx6sa5wCcZ1Nq0GpsPYbrFmjU1Os396Jqe+PLxlRuH+hlLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1776814917; x=1776901317; bh=ysdmAW6yl9jmU8VfHSGlMuTK/YUzR7AYXc8 YWLrpFLk=; b=nGa4T4VOqPWyJgov0gHDOT8Af/YA9hTeDe8izH+v9xpVYTfS77X ruL40/6NJu3enh15c7OIpnnhHglHPzC/mSWRim2DwTXi4rBgQDgz/063SybjgJlS ppGyC4z4DO94y1K9aCRRXf7tlbEi6DNuioKzTWbP3R6bDCeVnHxo4xXnhXZGGFCg GjsOMmkJf4fhYKwtwbXwWnS2CxpxAuuTMW2fR5ZCYswvxU7x6/KWyxV89W7HRxUj /JztZnt09+ek/ifpLXyuqsRSU57w9sbelGOl+R9lpdWgER+97AcpWBjpnh37d4sR Mnx57LI6sJrBXhdNNn3sk85KSTM/gsZFJ0Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdeivdejgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdefhedmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeegffejvefgveduvdejtddvtdeijeeh udeuledvudeftdfgfeejvdekveekiedvvdenucffohhmrghinhepphhoshhtghhrvghsqh hlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhho mhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidpnhgspghrtghpthhtohepuddtpd hmohguvgepshhmthhpohhuthdprhgtphhtthhopegrvghkohhrohhtkhhovhesghhmrghi lhdrtghomhdprhgtphhtthhopehsohhumhihrghmuhhrrghlihdrfihorhhksehgmhgrih hlrdgtohhmpdhrtghpthhtohepjhhimhdrjhhonhgvshesuhhnihdqmhhuvghnshhtvghr rdguvgdprhgtphhtthhopeefuggrnhhishhsihhmohesghhmrghilhdrtghomhdprhgtph htthhopehtghhlsehsshhsrdhpghhhrdhprgdruhhspdhrtghpthhtohepshhlphhmtghf sehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhosh htghhrvghsqhhlrdhorhhgpdhrtghpthhtohepmhhorghlihdrphhgsehgmhgrihhlrdgt ohhmpdhrtghpthhtohepjhgrfhhrihhnrgiinhgvvghnsehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Apr 2026 19:41:54 -0400 (EDT) Date: Wed, 22 Apr 2026 08:41:49 +0900 From: Michael Paquier To: Alexander Korotkov Cc: Soumya S Murali , Jim Jones , Daniil Davydov <3danissimo@gmail.com>, Tom Lane , Stepan Neretin , PostgreSQL Hackers , Mohamed Ali , Nazneen Jafri , Shawn McCoy Subject: Re: Fix bug with accessing to temporary tables of other sessions Message-ID: References: <402bbc8d-728b-4467-8024-31c2bc101ead@uni-muenster.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jgWmfIn17drjFfvG" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --jgWmfIn17drjFfvG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 21, 2026 at 01:54:47PM +0300, Alexander Korotkov wrote: > OK. I'm going to push and backpatch if no objections. Timing is interesting here. Last week I have been doing a on-site patch review with a couple of colleagues and myself, and this thread has been chosen as part of this exercise. I am attaching them in CC of this thread, and replying to this thread was an action item I had to act on. Here is some feedback, based on v18 posted here: https://www.postgresql.org/message-id/b6614954-6c71-451a-a1d7-345d255b4afb@= uni-muenster.de We have found that the thread does not state clearly what it aims to fix. The subject states that it is a bug, perhaps it is but the thread does not seem to do a good job in explaining why the current superuser behavior is bad, while the behavior of the patch to block some commands is better. This should be clearer in explaining why this new behavior is better. The test script is under-documented. There are zero comments that actually explain why the patch does what it does. The few comments present could be removed: they are copy-pasted of the descriptions of the test cases. A much worse thing is this thing: +# DROP TEMPORARY TABLE from other session +$node->safe_psql('postgres', "DROP TABLE $tempschema.foo;"); DROP TABLE on a temporary relation for a superuser is a very useful behavior to unstuck autovacuum if a temp relation has been orphaned. It looks critical to me to explain that we want to keep this behavior for this reason. Using safe_psql() is not really adapted. You should use a psql() where we check that the command does not fail, so as the test can generate a full report. The test coverage actually has holes. The three DML patterns INSERT, UPDATE and DELETE are covered, and it is missing MERGE. Also, what about other patterns like ALTER TABLE, ALTER INDEX, ALTER FUNCTION, DROP FUNCTION and the like? There are many object patterns that can be schema-qualified, and none of this is covered. What about the new REPACK and a bunch of other maintenance commands? There is nothing about VACUUM, TRUNCATE, CLUSTER, etc. Just to name a few. Another question is how do we make sure that new command patterns follow the same rule as what is enforced here. It looks like this should be at least documented somewhere to be less surprising, but the patch does nothing of the kind. As a whole the patch lacks documentation, comments, and explanations, making it difficult to act on. As a whole, we were not really convinced that this is something that needs any kind of specific fix, especially not something that should be backpatched. After saying all that, there is some value in what you are doing here: it is true that we lack test coverage in terms of interactions of temporary objects across multiple sessions, and that we should have some. TAP is adapted for this purpose, isolation tests could be an extra one but the schema names make that unpredictible in output. The patch unfortunately does a poor job in showing what it wants to change. One thing that I would suggest is to *reverse* the order of the patches: - First have a patch that introduces new tests, that shows the original behavior. This needs to be more complete in terms of command patterns. The DROP TABLE is one case that we want to keep. This should be kept as-is, and it is critical to document the reason why we want to keep things this way (aka autovacuum and orphaned tables, AFAIK). - Then implement the second patch that updates the tests introduced in the first patch, so as one can track *what* has changed, and so as one does not have to test manually what the original behavior was. =20 As a whole, this patch needs more work, based on what has been currently posted on the lists. That's not ready yet. The backpatch question is a separate matter. Thanks, -- Michael --jgWmfIn17drjFfvG Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmnoCz0ACgkQnvQgOdby QH2tlw//Uq01Z0b1DAqg/dajaF9M4yPAL/X66LI5D3hSntDCvD91EJQXrx002ByN TlDejUwUtLVZNrg+WNlHL6YDSsOmftutcrb1C5/vV1U5VXSjKp3hPMPOLOx2qL3R hRUa9WcCAyv3oScqK+Qg3YpkRGfh4HXcto951Sn8e2G2+ik5tIP0oUFx3kLk5lJ2 Y4sQ2PKW9akubLPAFxR1wImecfK+Yrc6dAZdeL7cdwKvQJEq4XewYYIEjS/cC+Nz KTnC27CI2Uaqy03Lf7RJPRGX6CFgtK5mICI0H1EOUud2bEjbgrxyEf383ZZ1NkVB 0G1ro7lmrTDHKT3Vt5FyBp1knEwTu2zBRDWCZqvEaivCm7eEBHTJRWx03QtPjUlu MxplsUD7mpfkItlUCanNO3+mdNnQDQZDSF/Nzp6SyKmaHg1RPd8JCjmA+EPXUNgU 845ueVDU7nMo9PtZ4VK1q2Ln/IpDq8wyWN47+nJm6ZkOYbK+Xma+1pnsCo9dL7Lg t4zUm2VmYzASKoeK3YZd/RladRYMYDh0pxfdQp30bwX5mqg/eDbnFPN0sDaKARKI jVK47GUyXkvOcWwJ+SJTLA5efQU428MHVPIEOJD3qy6eBrLMyrziSwPL601Sf3R4 ohRSZJdUy8n6C5HG/2I8SYlHwsP+4LEpYJ2bad3bPBrqPxrTs4M= =7cGA -----END PGP SIGNATURE----- --jgWmfIn17drjFfvG--