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

Commitefcb601

Browse files
committed
Adjust the order of the prechecks in pgrowlocks()
4b82664 added a precheck to pgrowlocks() to ensure the given object'spg_class.relam is HEAP_TABLE_AM_OID, however, that check was put beforeanother check which was checking if the given object was a partitionedtable. Since the pg_class.relam is always InvalidOid for partitionedtables, if pgrowlocks() was called passing a partitioned table, then the"only heap AM is supported" error would be raised instead of the intendederror about the given object being a partitioned table.Here we simply move the pg_class.relam check to after the check thatverifies that we are in fact working with a normal (non-partitioned)table.Reported-by: jian heDiscussion:https://postgr.es/m/CACJufxFaSp_WguFCf0X98951zFVX+dXFnF1mxAb-G3g1HiHOow@mail.gmail.comBackpatch-through: 12, where4b82664 was introduced.
1 parent975ae05 commitefcb601

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎contrib/pgrowlocks/pgrowlocks.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ pgrowlocks(PG_FUNCTION_ARGS)
107107
relrv=makeRangeVarFromNameList(textToQualifiedNameList(relname));
108108
rel=relation_openrv(relrv,AccessShareLock);
109109

110-
if (rel->rd_rel->relam!=HEAP_TABLE_AM_OID)
111-
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
112-
errmsg("only heap AM is supported")));
113-
114110
if (rel->rd_rel->relkind==RELKIND_PARTITIONED_TABLE)
115111
ereport(ERROR,
116112
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
@@ -122,6 +118,10 @@ pgrowlocks(PG_FUNCTION_ARGS)
122118
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
123119
errmsg("\"%s\" is not a table",
124120
RelationGetRelationName(rel))));
121+
elseif (rel->rd_rel->relam!=HEAP_TABLE_AM_OID)
122+
ereport(ERROR,
123+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
124+
errmsg("only heap AM is supported")));
125125

126126
/*
127127
* check permissions: must have SELECT on table or be in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp