Fix create schema with grant all.

This commit is contained in:
TotaJ 2021-01-20 11:22:04 +08:00
parent 1d4815bd7c
commit 3d4621061c
3 changed files with 27 additions and 1 deletions

View File

@ -4299,7 +4299,8 @@ List* transformCreateSchemaStmt(CreateSchemaStmt* stmt)
cxt.triggers = lappend(cxt.triggers, element);
} break;
case T_GrantStmt:
case T_GrantStmt: /* GRANT XXX ON XXX TO XXX */
case T_AlterRoleStmt: /* GRANT ALL PRIVILEGES TO XXX */
cxt.grants = lappend(cxt.grants, element);
break;

View File

@ -26,6 +26,22 @@ 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;
create user grant_user_test password 'test-1234';
select rolsystemadmin from pg_roles where rolname='grant_user_test';
rolsystemadmin
----------------
f
(1 row)
create schema schema_with_grant_test grant all privileges to grant_user_test;
select rolsystemadmin from pg_roles where rolname='grant_user_test';
rolsystemadmin
----------------
t
(1 row)
drop user grant_user_test;
drop schema schema_with_grant_test;
drop schema test_ns_schema_1 cascade;
NOTICE: drop cascades to 2 other objects
DETAIL: drop cascades to table test_ns_schema_1.abc

View File

@ -31,4 +31,13 @@ create user pg_error_username password 'test-1234';
drop role samedb_schema_cn_role_02_001;
create user grant_user_test password 'test-1234';
select rolsystemadmin from pg_roles where rolname='grant_user_test';
create schema schema_with_grant_test grant all privileges to grant_user_test;
select rolsystemadmin from pg_roles where rolname='grant_user_test';
drop user grant_user_test;
drop schema schema_with_grant_test;
drop schema test_ns_schema_1 cascade;