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

Commitb56818a

Browse files
committed
Teach pgrowlocks to check relkind before scanning
Author: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
1 parentfb886c1 commitb56818a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎contrib/pgrowlocks/pgrowlocks.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,19 @@ pgrowlocks(PG_FUNCTION_ARGS)
9797

9898
relname=PG_GETARG_TEXT_PP(0);
9999
relrv=makeRangeVarFromNameList(textToQualifiedNameList(relname));
100-
rel=heap_openrv(relrv,AccessShareLock);
100+
rel=relation_openrv(relrv,AccessShareLock);
101+
102+
if (rel->rd_rel->relkind==RELKIND_PARTITIONED_TABLE)
103+
ereport(ERROR,
104+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
105+
errmsg("\"%s\" is a partitioned table",
106+
RelationGetRelationName(rel)),
107+
errdetail("Partitioned tables do not contain rows.")));
108+
elseif (rel->rd_rel->relkind!=RELKIND_RELATION)
109+
ereport(ERROR,
110+
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
111+
errmsg("\"%s\" is not a table",
112+
RelationGetRelationName(rel))));
101113

102114
/*
103115
* check permissions: must have SELECT on table or be in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp