!3614 修复缺陷:执行grant select (prosrc) on pg_proc to test后,数据库宕机

Merge pull request !3614 from 午月/fix_bug
This commit is contained in:
opengauss_bot
2023-06-30 08:47:35 +00:00
committed by Gitee
3 changed files with 19 additions and 0 deletions

View File

@ -6095,6 +6095,15 @@ void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
errmsg("All built-in functions are hard coded, and they should not be updated.")));
}
/* All attribute of system table columns are hard coded, and thus they should not be updated */
if (u_sess->attr.attr_common.IsInplaceUpgrade == false && IsAttributeRelation(relation)) {
Oid attrelid = ((Form_pg_attribute)GETSTRUCT(tup))->attrelid;
if (IsSystemObjOid(attrelid)) {
ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("All attribute of system table columns are hard coded, and they should not be updated.")));
}
}
result = heap_update(relation,
NULL,
otid,

View File

@ -1134,3 +1134,8 @@ DROP TABLE gtest1;
DROP TABLE gtest2;
DROP TABLE gtest3;
DROP TABLE gtest10;
CREATE USER grant_attr_user1 PASSWORD 'gauss@123';
GRANT select (prosrc) on pg_proc to grant_attr_user1;
ERROR: All attribute of system table columns are hard coded, and they should not be updated.
revoke select (prosrc) on pg_proc from grant_attr_user1;
drop user grant_attr_user1 cascade;

View File

@ -669,3 +669,8 @@ DROP TABLE gtest2;
DROP TABLE gtest3;
DROP TABLE gtest10;
CREATE USER grant_attr_user1 PASSWORD 'gauss@123';
GRANT select (prosrc) on pg_proc to grant_attr_user1;
revoke select (prosrc) on pg_proc from grant_attr_user1;
drop user grant_attr_user1 cascade;