Skip to content

Commit

Permalink
Add more testcases
Browse files Browse the repository at this point in the history
Signed-off-by: ANJU BHARTI <[email protected]>
  • Loading branch information
ANJU BHARTI committed Dec 20, 2024
1 parent 21e2d6e commit b33ac65
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/babelfishpg_tsql/src/rolecmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,7 @@ check_alter_server_stmt(GrantRoleStmt *stmt)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("'sysadmin' role cannot be granted to login: a user is already created in database '%s'", db_name)));

/* Forbidden the use of fixed server principals as grantee*/
/* Restrict adding fixed server roles as member*/
if (IS_BBF_FIXED_SERVER_ROLE(grantee_name))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
Expand Down
28 changes: 28 additions & 0 deletions test/JDBC/expected/dbcreator_role-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,34 @@ go
~~ERROR (Message: Cannot use the special principal 'dbcreator')~~


Alter server role dbcreator add member sysadmin
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'sysadmin')~~


Alter server role securityadmin add member sysadmin
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'sysadmin')~~


Alter server role dbcreator add member dbcreator
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'dbcreator')~~


Alter server role sysadmin add member sysadmin
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'sysadmin')~~


-- terminate-tsql-conn

-- tsql user=dbcreator_login1 password=123
Expand Down
28 changes: 28 additions & 0 deletions test/JDBC/expected/single_db/dbcreator_role-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,34 @@ go
~~ERROR (Message: Cannot use the special principal 'dbcreator')~~


Alter server role dbcreator add member sysadmin
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'sysadmin')~~


Alter server role securityadmin add member sysadmin
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'sysadmin')~~


Alter server role dbcreator add member dbcreator
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'dbcreator')~~


Alter server role sysadmin add member sysadmin
go
~~ERROR (Code: 33557097)~~

~~ERROR (Message: Cannot use the special principal 'sysadmin')~~


-- terminate-tsql-conn

-- tsql user=dbcreator_login1 password=123
Expand Down

0 comments on commit b33ac65

Please sign in to comment.