-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
52869: sql: add CONTROLCHANGEFEED role option r=solongordon a=solongordon Fixes #52869 Release note (sql change): Introduced a new CONTROLCHANGEFEED role option. This grants non-admin roles the ability to create new changefeeds, as long as they have SELECT privileges on the target table. It can be conferred via `ALTER ROLE <role> CONTROLCHANGEFEED` and revoked via `ALTER ROLE <role> NOCONTROLCHANGEFEED`. Co-authored-by: Solon Gordon <[email protected]>
- Loading branch information
Showing
8 changed files
with
127 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# LogicTest: local | ||
|
||
statement ok | ||
CREATE TABLE t () | ||
|
||
user testuser | ||
|
||
statement error permission denied to create changefeed | ||
CREATE CHANGEFEED FOR t | ||
|
||
user root | ||
|
||
# Test granting CONTROLCHANGEFEED. | ||
statement ok | ||
ALTER USER testuser CONTROLCHANGEFEED; | ||
GRANT SELECT ON DATABASE test TO testuser | ||
|
||
user testuser | ||
|
||
# Now we should pass the CONTROLCHANGEFEED permission check but error on missing | ||
# SELECT privileges. | ||
statement error user testuser does not have SELECT privilege on relation t | ||
CREATE CHANGEFEED FOR t | ||
|
||
# Test revoking CONTROLCHANGEFEED. | ||
user root | ||
|
||
statement ok | ||
ALTER USER testuser NOCONTROLCHANGEFEED | ||
|
||
user testuser | ||
|
||
statement error permission denied to create changefeed | ||
CREATE CHANGEFEED FOR t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters