修复以'pg_temp_'为命名前缀的模式可以创建成功的问题

This commit is contained in:
zhangyukai
2024-12-03 15:23:33 +08:00
committed by congzhou2603
parent ff90331e56
commit cbf877d467
2 changed files with 14 additions and 1 deletions

View File

@ -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?
*/

View File

@ -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);