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 1ikTa9-0004we-0C for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Dec 2019 13:53:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikTa6-0006ri-Mk for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Dec 2019 13:53:38 +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 1ikTa6-0006rb-DZ for pgsql-hackers@lists.postgresql.org; Thu, 26 Dec 2019 13:53:38 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ikTa4-0005el-3G for pgsql-hackers@lists.postgresql.org; Thu, 26 Dec 2019 13:53:38 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id C7C4B810; Thu, 26 Dec 2019 08:53:33 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 26 Dec 2019 08:53:34 -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=+6NqWRsYZjx8ws5QcSdwwEX5Fpp i5d1y22o7yRnSUvI=; b=OcIplos9YXiOH6qC0N7yg2w2i2XUlcbkswgcScjkOA7 w6Oue1AaIch85uyJhAlXx5IUJUzPj552R6BumdpQuBhDyb6nqms3RbGBFxb7UDor hf2xpQCO4vWOTJyOXYesuKRgh0QbC/QrpLF2EykyvkGpMkHWsdWl+Ag857KrxHmo CucioRlGDf3PE7uf35omFTqNJ4TWqyVqkATz7KzKfYXOTrW5fxfNzRhzOIM2PICY cfNzl5fIZWNObLciw19wdS/xKkXtaXAmxGUQToG1iV8Hgu2EU78b3YNNwGO17DyV rB105MEHlWeneKkI5HVTXwveTzW8ht2zSkTS7JBroIw== 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=+6NqWR sYZjx8ws5QcSdwwEX5Fppi5d1y22o7yRnSUvI=; b=W48+Gi4CGyetlWC3ZpQAib wOBjpFGTjlAHVDlAFB95K9M+RF16f66tvcOaZEKgxz8QN+BA+V3+Zq7CJCY2/Mit ORg5z9HfkRgRUQGszH5Cd+WmRYTgGFYoqK9PbPj7iRKhPyhjmr11W+dR0suXYZgR N17oNmAymYZOX7JJGyLkJbGfSWAeNKFZY373oPKzlAa9SLaaDDACl+cl7TDedrWz jjwVcBK7HZ5BUupzURoJ3qbH+6QqPjkTaAGShRMwaDPqRugVqWjJH5Dw82zlPhAb LCVQxhZw61yG5lEZUJzmMTHzHe2o23EnyQt5yLUVwKuxYPQGCVUZ7vLF7MrN8pQw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddviedgheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucfkphepudduuddrud dtvddrudektddrudekheenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhes phgrqhhuihgvrhdrgiihiienucevlhhushhtvghrufhiiigvpedt 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 BD70380062; Thu, 26 Dec 2019 08:53:31 -0500 (EST) Date: Thu, 26 Dec 2019 22:53:29 +0900 From: Michael Paquier To: Kyotaro Horiguchi Cc: mahi6run@gmail.com, pgsql-hackers@lists.postgresql.org 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: <20191226135329.GA249363@paquier.xyz> References: <20191225022203.GD3448@paquier.xyz> <20191225.121826.1424647210525092235.horikyota.ntt@gmail.com> <20191225032410.GG3448@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="hHWLQfXTYDoKhP50" Content-Disposition: inline In-Reply-To: <20191225032410.GG3448@paquier.xyz> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --hHWLQfXTYDoKhP50 Content-Type: multipart/mixed; boundary="MGYHOYXEY6WxJCY8" Content-Disposition: inline --MGYHOYXEY6WxJCY8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Dec 25, 2019 at 12:24:10PM +0900, Michael Paquier wrote: > Arf. Yes, this had better be isAnyTempNamespace() so as we complain > about all of them. Okay, finally coming back to that. Attached is an updated patch with polished comments and the fixed logic. -- Michael --MGYHOYXEY6WxJCY8 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="drop-temp-schema-v2.patch" Content-Transfer-Encoding: quoted-printable diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmd= s.c index be7a40d5d2..f5b1a662a7 100644 --- a/src/backend/commands/dropcmds.c +++ b/src/backend/commands/dropcmds.c @@ -101,6 +101,21 @@ 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 namespace \"%s\"", + get_namespace_name(address.objectId)))); + /* Check permissions. */ namespaceId =3D get_object_namespace(&address); if (!OidIsValid(namespaceId) || --MGYHOYXEY6WxJCY8-- --hHWLQfXTYDoKhP50 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4Eu1kACgkQnvQgOdby QH1UPw//dRXZ497yMrvLHn3IAYGQWID3pQQwf+Q/M1I/ELVuhJnBxBedO/21Omli vBlYJagyPP/iQg2pv5XECL+8IKH+ufEJUnQJrdDgtDkJQwALBH2fZWtA7smdcEzI An7E1ZX2TAkKMvDZLBWvCQqawJf0DlOFR5yF3K93eLNOT3RV54eBz0jKtjhRtcvK eo1/yn0Cgxr0wmumYmU3h02ZAfGduh8ZCBLQ/IdvR70Ui/CUEg6dzh5jH0xtZdj3 a+NrKMpJU/XMWQaAfklkv0GJQuFduoWY1DYXgM2rznL/uWFu9QHfyv56BKQhXxSo luIwbIsDaTPPg/foIJbEvBejR8ATYCJwL6KidbIiCRJCkwhLmtKfyDdu5ylsADS2 z+pCP5VmPLxQpvDDZDHsclsFYpzRwjFTvXOW7RNJhjVHKLWPB6QFTXtCyoXjlmkK 5hz2B4GX4lvSg/5orCc9WJreKwYYTmhNOv8xq4uDW17sYNMrDCq8DNDpQgoZpXqm yfRm50XdEHBz1YGPj9JqJAQOeBOAi2i1wuK7ErRIWJRwgMK5hZhNEWdQPVJp/Oms /46lZ7VajrFCnmymQcMnxRMNVaVIchPPCARrUeK583P0+z12cY+iHjvJK/qhys8w rrz+Inuu00u4IR/HBt60f02I6OEP92Tdd1eRxFbYAQOFGI9Dn6Q= =cN0+ -----END PGP SIGNATURE----- --hHWLQfXTYDoKhP50--