Content-Length: 279625 | pFad | http://github.com/postgrespro/postgres_cluster/commit/b56818abd450a87e2e3cb03b2cf3eede73487926

11 Teach pgrowlocks to check relkind before scanning · postgrespro/postgres_cluster@b56818a · GitHub
Skip to content

Commit b56818a

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

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+
else if (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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/b56818abd450a87e2e3cb03b2cf3eede73487926

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy