From: Michael Paquier <michael@paquier.xyz>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: mahi6run@gmail.com
Cc: 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
Date: Thu, 26 Dec 2019 22:53:29 +0900
Message-ID: <20191226135329.GA249363@paquier.xyz> (raw)
In-Reply-To: <20191225032410.GG3448@paquier.xyz>
References: <CAKYtNAr9Zq=1-ww4etHo-VCC-k120YxZy5OS01VkaLPaDbv2tg@mail.gmail.com>
<20191225022203.GD3448@paquier.xyz>
<20191225.121826.1424647210525092235.horikyota.ntt@gmail.com>
<20191225032410.GG3448@paquier.xyz>
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
Attachments:drop-temp-schema-v2.patch (text/x-diff, 1.1K) downloaddiff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmds.cindex 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.")));
}
+ /*+ * 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 == 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 = get_object_namespace(&address);
if (!OidIsValid(namespaceId) ||
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, horikyota.ntt@gmail.com, 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
In-Reply-To: <20191226135329.GA249363@paquier.xyz>
References: <CAKYtNAr9Zq=1-ww4etHo-VCC-k120YxZy5OS01VkaLPaDbv2tg@mail.gmail.com> <20191225022203.GD3448@paquier.xyz> <20191225.121826.1424647210525092235.horikyota.ntt@gmail.com> <20191225032410.GG3448@paquier.xyz> <20191226135329.GA249363@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox