From cbf877d467a63e54fa90ae3b09a0ec685247ccf1 Mon Sep 17 00:00:00 2001 From: zhangyukai Date: Tue, 3 Dec 2024 15:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=A5'pg=5Ftemp=5F'?= =?UTF-8?q?=E4=B8=BA=E5=91=BD=E5=90=8D=E5=89=8D=E7=BC=80=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E5=8F=AF=E4=BB=A5=E5=88=9B=E5=BB=BA=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gausskernel/optimizer/commands/schemacmds.cpp | 11 +++++++++++ .../process/postmaster/twophasecleaner.cpp | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gausskernel/optimizer/commands/schemacmds.cpp b/src/gausskernel/optimizer/commands/schemacmds.cpp index 613546932..bb3affc67 100644 --- a/src/gausskernel/optimizer/commands/schemacmds.cpp +++ b/src/gausskernel/optimizer/commands/schemacmds.cpp @@ -133,6 +133,17 @@ Oid CreateSchemaCommand(CreateSchemaStmt* stmt, const char* queryString) errdetail("The prefix \"gs_role_\" is reserved."))); } +#ifndef ENABLE_MULTIPLE_NODES + if (!g_instance.attr.attr_common.allowSystemTableMods && + stmt->temptype == Temp_None && + (isTempNamespaceName(stmt->schemaname) || isToastTempNamespaceName(stmt->schemaname))) { + ereport(ERROR, + (errcode(ERRCODE_RESERVED_NAME), + errmsg("unacceptable schema name \"%s\"", schemaName), + errdetail("The prefix \"pg_temp_\" is reserved."))); + } +#endif + /* * Who is supposed to own the new schema? */ diff --git a/src/gausskernel/process/postmaster/twophasecleaner.cpp b/src/gausskernel/process/postmaster/twophasecleaner.cpp index 86177ad93..cad5af6e3 100644 --- a/src/gausskernel/process/postmaster/twophasecleaner.cpp +++ b/src/gausskernel/process/postmaster/twophasecleaner.cpp @@ -841,7 +841,9 @@ static void DropTempSchemas(PGconn* conn) if (thirdLastPos == NULL) { PQfinish(conn); conn = NULL; - elog(ERROR, "strrchr failed, can't find '%c' in '%s'\n", '_', tempBuffer2); + elog(ERROR, "strrchr failed, can't find '%c' in '%s'. " + "the schema name '%s' is reserved, advise to delete manually\n", + '_', tempBuffer2, tempSchema->tempSchemaName); } uint32 timeLineID = strtol(thirdLastPos + 1, NULL, 10);