!637 创建schema时不能以"pg_"开头
Merge pull request !637 from TotaJ/bugfix/create_schema
This commit is contained in:
@ -141,7 +141,10 @@ void CreateSchemaCommand(CreateSchemaStmt* stmt, const char* queryString)
|
||||
//@Temp Table. We allow datanode to create pg_temp namespace to enable create namespace stmt by CN to execute on
|
||||
// DN
|
||||
if (!g_instance.attr.attr_common.allowSystemTableMods && !u_sess->attr.attr_common.IsInplaceUpgrade &&
|
||||
IsReservedName(schemaName) && !IS_PGXC_DATANODE)
|
||||
#ifdef ENABLE_MULTIPLE_NODES
|
||||
!IS_PGXC_DATANODE &&
|
||||
#endif
|
||||
IsReservedName(schemaName))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_RESERVED_NAME),
|
||||
errmsg("unacceptable schema name \"%s\"", schemaName),
|
||||
|
||||
@ -17,6 +17,14 @@ create table abc(
|
||||
b int
|
||||
);
|
||||
NOTICE: CREATE TABLE will create implicit sequence "abc_a_seq" for serial column "abc.a"
|
||||
--illegal schema name, start with 'pg_'
|
||||
create schema pg_error_schema;
|
||||
ERROR: unacceptable schema name "pg_error_schema"
|
||||
DETAIL: The prefix "pg_" is reserved for system schemas.
|
||||
--create user will create a schema which name is same as username, so it is also illegal.
|
||||
create user pg_error_username password 'test-1234';
|
||||
ERROR: unacceptable user name: fail to create same name schema for user "pg_error_username"
|
||||
DETAIL: The prefix "pg_" is reserved for system schemas.
|
||||
drop role samedb_schema_cn_role_02_001;
|
||||
drop schema test_ns_schema_1 cascade;
|
||||
NOTICE: drop cascades to 2 other objects
|
||||
|
||||
@ -24,6 +24,11 @@ create table abc(
|
||||
b int
|
||||
);
|
||||
|
||||
--illegal schema name, start with 'pg_'
|
||||
create schema pg_error_schema;
|
||||
--create user will create a schema which name is same as username, so it is also illegal.
|
||||
create user pg_error_username password 'test-1234';
|
||||
|
||||
drop role samedb_schema_cn_role_02_001;
|
||||
|
||||
drop schema test_ns_schema_1 cascade;
|
||||
|
||||
Reference in New Issue
Block a user