From: Jeff Davis Date: Tue, 29 Oct 2024 17:14:23 +0000 (-0700) Subject: Add missing CommandCounterIncrement() in stats import functions. X-Git-Tag: REL_18_BETA1~1596 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=f22e436bff779fee4e1ce49733ba5791d4634fb1;p=postgresql.git Add missing CommandCounterIncrement() in stats import functions. Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/98b2fcf0-f701-369e-d63d-6be9739ce17c@gmail.com --- diff --git a/src/backend/statistics/attribute_stats.c b/src/backend/statistics/attribute_stats.c index af61fd79e49..4ae0722b781 100644 --- a/src/backend/statistics/attribute_stats.c +++ b/src/backend/statistics/attribute_stats.c @@ -752,6 +752,8 @@ upsert_pg_statistic(Relation starel, HeapTuple oldtup, } heap_freetuple(newtup); + + CommandCounterIncrement(); } /* @@ -762,6 +764,7 @@ delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit) { Relation sd = table_open(StatisticRelationId, RowExclusiveLock); HeapTuple oldtup; + bool result = false; /* Is there already a pg_statistic tuple for this attribute? */ oldtup = SearchSysCache3(STATRELATTINH, @@ -773,12 +776,14 @@ delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit) { CatalogTupleDelete(sd, &oldtup->t_self); ReleaseSysCache(oldtup); - table_close(sd, RowExclusiveLock); - return true; + result = true; } table_close(sd, RowExclusiveLock); - return false; + + CommandCounterIncrement(); + + return result; } /* diff --git a/src/backend/statistics/relation_stats.c b/src/backend/statistics/relation_stats.c index 5a2aabc921e..ed5dea2e058 100644 --- a/src/backend/statistics/relation_stats.c +++ b/src/backend/statistics/relation_stats.c @@ -171,6 +171,8 @@ relation_statistics_update(FunctionCallInfo fcinfo, int elevel) /* release the lock, consistent with vac_update_relstats() */ table_close(crel, RowExclusiveLock); + CommandCounterIncrement(); + return result; }