提交 a24afb6e 编写于 作者: D Daniel Gustafsson

Enable comments on Resource Groups

This adds the basic scaffolding for allowing COMMENT ON RESOURCE
GROUP, but without any user visible functions for retrieving the
comment. Since we allow COMMENTs on resource queues, we should do
the same for resource groups for completeness.
上级 ace7a3e9
......@@ -17,6 +17,7 @@
OPERATOR <varname>op</varname> (<varname>leftoperand_type</varname>, <varname>rightoperand_type</varname>) |
OPERATOR CLASS <varname>object_name</varname> USING <varname>index_method</varname> |
[PROCEDURAL] LANGUAGE <varname>object_name</varname> |
RESOURCE GROUP <varname>object_name</varname> |
  RESOURCE QUEUE <varname>object_name</varname> |
ROLE <varname>object_name</varname> |
RULE <varname>rule_name</varname> ON <varname>table_name</varname> |
......
......@@ -42,6 +42,7 @@
#include "catalog/pg_operator.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_rewrite.h"
#include "catalog/pg_resgroup.h"
#include "catalog/pg_resqueue.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_trigger.h"
......@@ -55,6 +56,7 @@
#include "commands/extension.h"
#include "commands/proclang.h"
#include "commands/queue.h"
#include "commands/resgroupcmds.h"
#include "commands/tablespace.h"
#include "commands/trigger.h"
#include "foreign/foreign.h"
......@@ -240,6 +242,11 @@ get_object_address(ObjectType objtype, List *objname, List *objargs,
address.objectId = get_resqueue_oid(NameListToString(objname), false);
address.objectSubId = 0;
break;
case OBJECT_RESGROUP:
address.classId = ResGroupRelationId;
address.objectId = GetResGroupIdForName(NameListToString(objname));
address.objectSubId = 0;
break;
default:
elog(ERROR, "unrecognized objtype: %d", (int) objtype);
/* placate compiler, in case it thinks elog might return */
......@@ -718,6 +725,9 @@ object_exists(ObjectAddress address)
case ResQueueRelationId:
indexoid = ResQueueOidIndexId;
break;
case ResGroupRelationId:
cache = RESGROUPOID;
break;
default:
elog(ERROR, "unrecognized classid: %u", address.classId);
}
......@@ -895,6 +905,7 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
case OBJECT_TSPARSER:
case OBJECT_TSTEMPLATE:
case OBJECT_RESQUEUE:
case OBJECT_RESGROUP:
/* We treat these object types as being owned by superusers */
if (!superuser_arg(roleid))
ereport(ERROR,
......
......@@ -7385,6 +7385,7 @@ comment_type:
| SERVER { $$ = OBJECT_FOREIGN_SERVER; }
| FOREIGN DATA_P WRAPPER { $$ = OBJECT_FDW; }
| RESOURCE QUEUE { $$ = OBJECT_RESQUEUE; }
| RESOURCE GROUP_P { $$ = OBJECT_RESGROUP; }
;
comment_text:
......
......@@ -1264,7 +1264,8 @@ typedef enum ObjectType
OBJECT_TSTEMPLATE,
OBJECT_TYPE,
OBJECT_VIEW,
OBJECT_RESQUEUE
OBJECT_RESQUEUE,
OBJECT_RESGROUP
} ObjectType;
/* ----------------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册