-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bugs for GRANT/REVOKE on SCHEMA #2031
Fix bugs for GRANT/REVOKE on SCHEMA #2031
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Collations changes looks okay to me!
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), | ||
errmsg("Cannot find the principal '%s', because it does not exist or you do not have permission.", grantee_name))); | ||
|
||
if (pg_namespace_ownercheck(schemaOid, role_oid) || is_member_of_role(role_oid, datdba) || grantee_is_db_owner) | ||
if ((strcmp(rolname, user) == 0) || pg_namespace_ownercheck(schemaOid, role_oid) || is_member_of_role(role_oid, get_sysadmin_oid()) || grantee_is_db_owner) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will this work for multi-db?
(strcmp(rolname, user) == 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you suggest a case which might fail?
I have ran the test framework in both single-db and multi-db mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is user = public ever possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not possible. User will not be public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rolname
can be public, but not user
.
ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), | ||
errmsg("Cannot find the principal '%s', because it does not exist or you do not have permission.", grantee_name))); | ||
|
||
if (pg_namespace_ownercheck(schemaOid, role_oid) || is_member_of_role(role_oid, datdba) || grantee_is_db_owner) | ||
if ((strcmp(rolname, user) == 0) || pg_namespace_ownercheck(schemaOid, role_oid) || is_member_of_role(role_oid, get_sysadmin_oid()) || grantee_is_db_owner) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is user = public ever possible?
dd23da9
into
babelfish-for-postgresql:BABEL_3_X_DEV
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
…#2031)" (babelfish-for-postgresql#2051) This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
…#2031)" (babelfish-for-postgresql#2051) This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
…#2031)" (babelfish-for-postgresql#2051) This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
…#2031)" (babelfish-for-postgresql#2051) This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
…#2031)" (babelfish-for-postgresql#2051) This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
…#2031)" (babelfish-for-postgresql#2051) This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Bug fixes for GRANT/REVOKE .. ON SCHEMA 1. Server crash when using empty bracketed name. `schema::[]` 2. Server crash when using empty quoted identifier. `schema::""` 3. When granting permission to yourself, we need a different error message. 4. Error message in not-supported multi-keyword permission should (i) be in uppercase (ii) have a space between keywords 5. Not-supported object type in error message should be in uppercase 6. GRANT ON SCHEMA:: TO PUBLIC does not take effect 7. Specified collation for column names using NAME datatype Issues Resolved : BABEL-4344 Signed-off-by: Shalini Lohia <[email protected]>
This reverts commit dd23da9. Co-authored-by: Shalini Lohia <[email protected]>
Description
Bug fixes for GRANT/REVOKE .. ON SCHEMA
schema::[]
schema::""
Issues Resolved
JIRA: BABEL-4344
Signed-off-by: Shalini Lohia [email protected]
Test Scenarios Covered
Use case based - Added
Boundary conditions -
Arbitrary inputs -
Negative test cases -
Minor version upgrade tests -
Major version upgrade tests -
Performance tests -
Tooling impact -
Client tests -
Check List
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.