Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdc6b821

Browse files
committed
Remove duplicated code left behind by my recent refactoring of comment.c
These checks are also present in objectaddress.c, so there's no need torecheck here.
1 parent54d0e28 commitdc6b821

File tree

1 file changed

+4
-48
lines changed

1 file changed

+4
-48
lines changed

‎src/backend/commands/comment.c

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.118 2010/08/27 11:47:41 rhaas Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.119 2010/09/17 02:49:10 rhaas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -38,7 +38,6 @@
3838
* object types require something more complex; for those, we define helper
3939
* functions.
4040
*/
41-
staticvoidCheckRelationComment(intobjtype,Relationrelation);
4241
staticvoidCheckAttributeComment(Relationrelation);
4342
staticvoidCheckCastComment(List*qualname,List*arguments);
4443

@@ -92,7 +91,9 @@ CommentObject(CommentStmt *stmt)
9291
caseOBJECT_SEQUENCE:
9392
caseOBJECT_TABLE:
9493
caseOBJECT_VIEW:
95-
CheckRelationComment(stmt->objtype,relation);
94+
if (!pg_class_ownercheck(RelationGetRelid(relation),GetUserId()))
95+
aclcheck_error(ACLCHECK_NOT_OWNER,ACL_KIND_CLASS,
96+
RelationGetRelationName(relation));
9697
break;
9798
caseOBJECT_COLUMN:
9899
CheckAttributeComment(relation);
@@ -561,51 +562,6 @@ GetComment(Oid oid, Oid classoid, int32 subid)
561562
returncomment;
562563
}
563564

564-
/*
565-
* Check whether the user is allowed to comment on this relation.
566-
*/
567-
staticvoid
568-
CheckRelationComment(intobjtype,Relationrelation)
569-
{
570-
/* Check object security */
571-
if (!pg_class_ownercheck(RelationGetRelid(relation),GetUserId()))
572-
aclcheck_error(ACLCHECK_NOT_OWNER,ACL_KIND_CLASS,
573-
RelationGetRelationName(relation));
574-
575-
/* Next, verify that the relation type matches the intent */
576-
switch (objtype)
577-
{
578-
caseOBJECT_INDEX:
579-
if (relation->rd_rel->relkind!=RELKIND_INDEX)
580-
ereport(ERROR,
581-
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
582-
errmsg("\"%s\" is not an index",
583-
RelationGetRelationName(relation))));
584-
break;
585-
caseOBJECT_SEQUENCE:
586-
if (relation->rd_rel->relkind!=RELKIND_SEQUENCE)
587-
ereport(ERROR,
588-
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
589-
errmsg("\"%s\" is not a sequence",
590-
RelationGetRelationName(relation))));
591-
break;
592-
caseOBJECT_TABLE:
593-
if (relation->rd_rel->relkind!=RELKIND_RELATION)
594-
ereport(ERROR,
595-
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
596-
errmsg("\"%s\" is not a table",
597-
RelationGetRelationName(relation))));
598-
break;
599-
caseOBJECT_VIEW:
600-
if (relation->rd_rel->relkind!=RELKIND_VIEW)
601-
ereport(ERROR,
602-
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
603-
errmsg("\"%s\" is not a view",
604-
RelationGetRelationName(relation))));
605-
break;
606-
}
607-
}
608-
609565
/*
610566
* Check whether the user is allowed to comment on an attribute of the
611567
* specified relation.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp