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

Commit73635b6

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 parent13503eb commit73635b6

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
@@ -81,10 +81,6 @@ pgrowlocks(PG_FUNCTION_ARGS)
8181
relrv=makeRangeVarFromNameList(textToQualifiedNameList(relname));
8282
rel=relation_openrv(relrv,AccessShareLock);
8383

84-
if (rel->rd_rel->relam!=HEAP_TABLE_AM_OID)
85-
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
86-
errmsg("only heap AM is supported")));
87-
8884
if (rel->rd_rel->relkind==RELKIND_PARTITIONED_TABLE)
8985
ereport(ERROR,
9086
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
@@ -96,6 +92,10 @@ pgrowlocks(PG_FUNCTION_ARGS)
9692
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
9793
errmsg("\"%s\" is not a table",
9894
RelationGetRelationName(rel))));
95+
elseif (rel->rd_rel->relam!=HEAP_TABLE_AM_OID)
96+
ereport(ERROR,
97+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
98+
errmsg("only heap AM is supported")));
9999

100100
/*
101101
* check permissions: must have SELECT on table or be in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp