]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Address stats import review comments.
authorJeff Davis <jdavis@postgresql.org>
Thu, 6 Mar 2025 07:07:25 +0000 (23:07 -0800)
committerJeff Davis <jdavis@postgresql.org>
Thu, 6 Mar 2025 07:07:25 +0000 (23:07 -0800)
Reported-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxHG9MBQozbJQ4JRBcRbUO+t+sx4qLZX092rS_9b4SR_EA@mail.gmail.com

src/backend/statistics/relation_stats.c
src/backend/statistics/stat_utils.c

index 2c1cea3fc80f1ee3586055450616e456b4b12ccc..52dfa47718706361d4605289d1520d4fe9c7d1f1 100644 (file)
@@ -127,13 +127,7 @@ relation_statistics_update(FunctionCallInfo fcinfo)
 
        ctup = SearchSysCache1(RELOID, ObjectIdGetDatum(reloid));
        if (!HeapTupleIsValid(ctup))
-       {
-               ereport(WARNING,
-                               (errcode(ERRCODE_OBJECT_IN_USE),
-                                errmsg("pg_class entry for relid %u not found", reloid)));
-               table_close(crel, RowExclusiveLock);
-               return false;
-       }
+               elog(ERROR, "pg_class entry for relid %u not found", reloid);
 
        pgcform = (Form_pg_class) GETSTRUCT(ctup);
 
index 54ead90b5bb5ad76fab603670d4767055395798d..9647f5108b3f66145dedc54bce163a5f30d1b7ce 100644 (file)
@@ -136,12 +136,14 @@ stats_lock_check_privileges(Oid reloid)
 
        /*
         * For indexes, we follow the locking behavior in do_analyze_rel() and
-        * check_inplace_rel_lock(), which is to lock the table first in
-        * ShareUpdateExclusive mode and then the index in AccessShare mode.
+        * check_lock_if_inplace_updateable_rel(), which is to lock the table
+        * first in ShareUpdateExclusive mode and then the index in AccessShare
+        * mode.
         *
         * Partitioned indexes are treated differently than normal indexes in
-        * check_inplace_rel_lock(), so we take a ShareUpdateExclusive lock on
-        * both the partitioned table and the partitioned index.
+        * check_lock_if_inplace_updateable_rel(), so we take a
+        * ShareUpdateExclusive lock on both the partitioned table and the
+        * partitioned index.
         */
        switch (get_rel_relkind(reloid))
        {