[improvement](createtable)fix create table error msg in information_schema database (#18412)

---------

Co-authored-by: wudi <>
This commit is contained in:
wudi
2023-04-09 18:11:46 +08:00
committed by GitHub
parent f38e00b4c0
commit 6bf9bb2bfd
2 changed files with 6 additions and 0 deletions

View File

@ -23,6 +23,7 @@ import java.util.MissingFormatArgumentException;
public enum ErrorCode {
// Try our best to compatible with MySQL's
ERR_HASHCHK(1000, new byte[]{'H', 'Y', '0', '0', '0'}, "hashchk"),
ERR_CANT_CREATE_TABLE(1005, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create table '%s' (errno: %d - %s)"),
ERR_DB_CREATE_EXISTS(1007, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create database '%s'; database exists"),
ERR_DB_DROP_EXISTS(1008, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't drop database '%s'; database doesn't exist"),
ERR_DBACCESS_DENIED_ERROR(1044, new byte[]{'4', '2', '0', '0', '0'}, "Access denied for user '%s' to "

View File

@ -1107,6 +1107,11 @@ public class InternalCatalog implements CatalogIf<Database> {
// check if db exists
Database db = (Database) getDbOrDdlException(dbName);
// InfoSchemaDb can not create table
if (db instanceof InfoSchemaDb) {
ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName,
ErrorCode.ERR_CANT_CREATE_TABLE.getCode(), "not supported create table in this database");
}
// only internal table should check quota and cluster capacity
if (!stmt.isExternal()) {