Skip to content

Commit f22e436

Browse files
committed
Add missing CommandCounterIncrement() in stats import functions.
Reported-by: Alexander Lakhin Discussion: https://postgr.es/m/98b2fcf0-f701-369e-d63d-6be9739ce17c@gmail.com
1 parent 30d47ec commit f22e436

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/backend/statistics/attribute_stats.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@ upsert_pg_statistic(Relation starel, HeapTuple oldtup,
752752
}
753753

754754
heap_freetuple(newtup);
755+
756+
CommandCounterIncrement();
755757
}
756758

757759
/*
@@ -762,6 +764,7 @@ delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit)
762764
{
763765
Relation sd = table_open(StatisticRelationId, RowExclusiveLock);
764766
HeapTuple oldtup;
767+
bool result = false;
765768

766769
/* Is there already a pg_statistic tuple for this attribute? */
767770
oldtup = SearchSysCache3(STATRELATTINH,
@@ -773,12 +776,14 @@ delete_pg_statistic(Oid reloid, AttrNumber attnum, bool stainherit)
773776
{
774777
CatalogTupleDelete(sd, &oldtup->t_self);
775778
ReleaseSysCache(oldtup);
776-
table_close(sd, RowExclusiveLock);
777-
return true;
779+
result = true;
778780
}
779781

780782
table_close(sd, RowExclusiveLock);
781-
return false;
783+
784+
CommandCounterIncrement();
785+
786+
return result;
782787
}
783788

784789
/*

src/backend/statistics/relation_stats.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ relation_statistics_update(FunctionCallInfo fcinfo, int elevel)
171171
/* release the lock, consistent with vac_update_relstats() */
172172
table_close(crel, RowExclusiveLock);
173173

174+
CommandCounterIncrement();
175+
174176
return result;
175177
}
176178

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy