Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iozSY-0004AQ-2I for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jan 2020 00:44:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iozSV-0006jx-UQ for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Jan 2020 00:44:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iozSU-0006jk-C8 for pgsql-hackers@lists.postgresql.org; Wed, 08 Jan 2020 00:44:27 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iozSO-0007rg-At for pgsql-hackers@lists.postgresql.org; Wed, 08 Jan 2020 00:44:24 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 8327A73A; Tue, 7 Jan 2020 19:44:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 07 Jan 2020 19:44:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=WPVPfP2tP/ceOcS5nOysCtMsc1n BTBBxUlhNEP+ZKrY=; b=H5v1NLDfcGFy9tBVSQv/rAIO3Xa1YSdAa9RyhQh2FnU 0NcBTfD+0OSDr0QXA7vBMTVtBRuHzkEAKaaZ8M0hPfmLdhR6jUQDDJRaPsQJ0YjK ZPfECedkiW7KLOpBA2+UvsGgnmTQe8QzLyUKfY7rRBvjkXpEOquSbhXwLwW8PUt3 msJYHLKTbdBz3qNosme0+SfIOy563B0L35nzbDoAyKJeWLNqIKo5xQ4jkCJU/IKy r1eFjUcSXioh9GBsIEQ0DJLTsWJPyGKNms+d5vu2ucYwL3fOPT535cdNfpMNiQsn UmLGZma67w1WGP28sU1viBlxMBtR+kpZGadxUVJhgUQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=WPVPfP 2tP/ceOcS5nOysCtMsc1nBTBBxUlhNEP+ZKrY=; b=jGvROBfCP481r6PIUSr8fL irbvvm/RWuj03QTF4JrUjR8MddgpWcGIiv1hlmkKOOK6ac8xWb88A6Lj3D7UsOS7 LorAjfmRN0sqGgQ/gBy/pkThTD7E0d3deWjC6owncahpuAMBfsw4vhACASJ0DHD+ FH2DtSXyVnoAO9x8hT/yCiowtB1F0tZ9z/qOFqpfD+GicnjmTa5C7wXfDHHROyNV evbqkQanfA2Bn5vEDg3wSK4TGfb+S31rgDZGN5B6y0oxuUPfmJsl8asd/2v+wsHJ hgJ7UPK6dWQPvxpH8rPZ4+KL9oT7EJSgD4fseeUXFFQwiX8keVZkdV5q76PBIiLg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdehjedgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepudduuddruddtvddrudektddrudekheenucfrrghr rghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiienucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id DC4838005A; Tue, 7 Jan 2020 19:44:13 -0500 (EST) Date: Wed, 8 Jan 2020 09:44:09 +0900 From: Michael Paquier To: Tom Lane Cc: Robert Haas , Mahendra Singh , Kyotaro Horiguchi , PostgreSQL Hackers Subject: Re: Assert failure due to "drop schema pg_temp_3 cascade" for temporary tables and \d+ is not showing any info after drooping temp table schema Message-ID: <20200108004409.GA3413@paquier.xyz> References: <28862.1577382716@sss.pgh.pa.us> <20191227090604.GA540891@paquier.xyz> <20200106014202.GA3598@paquier.xyz> <31319.1578332027@sss.pgh.pa.us> <20200107002216.GA2386@paquier.xyz> <14868.1578420368@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cmJC7u66zC7hs+87" Content-Disposition: inline In-Reply-To: <14868.1578420368@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --cmJC7u66zC7hs+87 Content-Type: multipart/mixed; boundary="HlL+5n6rz5pIUxbD" Content-Disposition: inline --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jan 07, 2020 at 01:06:08PM -0500, Tom Lane wrote: > I still agree with Robert that a052f6c is a bad idea. It's not the case > that that's blocking "any connected user" from causing an issue. The > temp schemas are always owned by the bootstrap superuser, so only a > superuser could delete them. All that that patch is doing is preventing > superusers from doing something that they could reasonably wish to do, > and that is perfectly safe when there's not concurrent usage of the > schema. We are not normally that nanny-ish, and the case for being so > here seems pretty thin. Okay, I am running out of arguments then, so attached is a patch to address things. I would also prefer if we keep the relation name in the log even if the namespace is missing. -- Michael --HlL+5n6rz5pIUxbD Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="drop-temp-schema-adjust-v2.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmd= s.c index e7891a4418..b3131ab208 100644 --- a/src/backend/commands/dropcmds.c +++ b/src/backend/commands/dropcmds.c @@ -101,21 +101,6 @@ RemoveObjects(DropStmt *stmt) errhint("Use DROP AGGREGATE to drop aggregate functions."))); } =20 - /* - * Prevent the drop of a temporary schema, be it owned by the current - * session or another backend as this would mess up with the callback - * registered to clean up temporary objects at the end of a session. - * Note also that the creation of any follow-up temporary object would - * result in inconsistencies within the session whose temporary schema - * has been dropped. - */ - if (stmt->removeType =3D=3D OBJECT_SCHEMA && - isAnyTempNamespace(address.objectId)) - ereport(ERROR, - (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot drop temporary schema \"%s\"", - get_namespace_name(address.objectId)))); - /* Check permissions. */ namespaceId =3D get_object_namespace(&address); if (!OidIsValid(namespaceId) || diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/a= utovacuum.c index f0e40e36af..f6afe4dbb8 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -2250,11 +2250,22 @@ do_autovacuum(void) } =20 /* OK, let's delete it */ - ereport(LOG, - (errmsg("autovacuum: dropping orphan temp table \"%s.%s.%s\"", - get_database_name(MyDatabaseId), - get_namespace_name(classForm->relnamespace), - NameStr(classForm->relname)))); + if (log_min_messages <=3D LOG) + { + char *nspname =3D get_namespace_name(classForm->relnamespace); + + if (nspname !=3D NULL) + ereport(LOG, + (errmsg("autovacuum: dropping orphan temp table \"%s.%s.%s\"", + get_database_name(MyDatabaseId), + get_namespace_name(classForm->relnamespace), + NameStr(classForm->relname)))); + else + ereport(LOG, + (errmsg("autovacuum: dropping orphan temp table \"%s.(null).%s\" wit= h OID %u", + get_database_name(MyDatabaseId), + NameStr(classForm->relname), relid))); + } =20 object.classId =3D RelationRelationId; object.objectId =3D relid; --HlL+5n6rz5pIUxbD-- --cmJC7u66zC7hs+87 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4VJdkACgkQnvQgOdby QH3hDxAAjnfaB8jW6F3jvP9Sgx76k5HpaKaCrRx9dRmelLpo813VBTF4CEbaFaVa b4QXsvqlSCqrDyjhW4UIYaIbOJOwztIojPKPU6rH7BduVetN/yq+QBoVLWsmEzko WHfa8Krq+X9s/jltJDHvXk9ApDNcW2mSbPRtCgkwFZ4hgrqGHoDIEi5Db1JzbKOR uu8cxDzUHIDoIe84+yGpjgg2nNKScDUVNTE8jDCgr+JHnrVwHycO4rvDcMOw2ohY +V1rNtRFRCD/asSdiK5g6cI39tWjWx5rcA6/FbsE4jRGedtukOisZaO8C9bnM+xS be4jfVBOlLeAcF1utiOEZbcHFAxbzVmvca5OylMZKurC+53JoG3bAxhdqj3EkKs3 qop/9VQ0LbMOfw4wuREDqGFOpg1pPSv0haC3Bh1XPFVOiU3uVuOhbtp8agyaaZFy 16m2ozbg2VF29EUWue9ldSXGgaiw3LY+XB/vYtMiCr5E6m8jFlBNzICkVTAAZ431 PKI6IjOtXJDFTCbt5zoL10HLmmhwNRj1BCx0yn1Pzxd9pp/wYwNfyL1xtxh87Gz/ /lZl3etPVpxuXjUu2J1MSUy5p6JmEA/lvPC3xV8QlFUMo0ClU073u1I8g6MP0Fpv bo+f7WxGxatyFJL4I3QbtuyACQdU4Xc4RLXPp+vnDjdbCaXOYkM= =dKJp -----END PGP SIGNATURE----- --cmJC7u66zC7hs+87--