Skip to content

Commit 298944e

Browse files
committed
Address stats import review comments.
Reported-by: jian he <jian.universality@gmail.com> Discussion: https://postgr.es/m/CACJufxHG9MBQozbJQ4JRBcRbUO+t+sx4qLZX092rS_9b4SR_EA@mail.gmail.com
1 parent 39de4f1 commit 298944e

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/backend/statistics/relation_stats.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,7 @@ relation_statistics_update(FunctionCallInfo fcinfo)
127127

128128
ctup = SearchSysCache1(RELOID, ObjectIdGetDatum(reloid));
129129
if (!HeapTupleIsValid(ctup))
130-
{
131-
ereport(WARNING,
132-
(errcode(ERRCODE_OBJECT_IN_USE),
133-
errmsg("pg_class entry for relid %u not found", reloid)));
134-
table_close(crel, RowExclusiveLock);
135-
return false;
136-
}
130+
elog(ERROR, "pg_class entry for relid %u not found", reloid);
137131

138132
pgcform = (Form_pg_class) GETSTRUCT(ctup);
139133

src/backend/statistics/stat_utils.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,14 @@ stats_lock_check_privileges(Oid reloid)
136136

137137
/*
138138
* For indexes, we follow the locking behavior in do_analyze_rel() and
139-
* check_inplace_rel_lock(), which is to lock the table first in
140-
* ShareUpdateExclusive mode and then the index in AccessShare mode.
139+
* check_lock_if_inplace_updateable_rel(), which is to lock the table
140+
* first in ShareUpdateExclusive mode and then the index in AccessShare
141+
* mode.
141142
*
142143
* Partitioned indexes are treated differently than normal indexes in
143-
* check_inplace_rel_lock(), so we take a ShareUpdateExclusive lock on
144-
* both the partitioned table and the partitioned index.
144+
* check_lock_if_inplace_updateable_rel(), so we take a
145+
* ShareUpdateExclusive lock on both the partitioned table and the
146+
* partitioned index.
145147
*/
146148
switch (get_rel_relkind(reloid))
147149
{

0 commit comments

Comments
 (0)