From 7784456ce74c98c042791a492741700e8d1523f4 Mon Sep 17 00:00:00 2001 From: "Zizhuan Liu(X-MAN)" <44973863@qq.com> Date: Thu, 28 May 2026 12:19:41 +0800 Subject: [PATCH v2] Avoid calling SetMatViewPopulatedState if possible --- src/backend/commands/matview.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index f7d8007..d090bad 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -296,7 +296,8 @@ RefreshMatViewByOid(Oid matviewOid, bool is_create, bool skipData, * Tentatively mark the matview as populated or not (this will roll back * if we fail later). */ - SetMatViewPopulatedState(matviewRel, !skipData); + if (RelationIsPopulated(matviewRel) != !skipData) + SetMatViewPopulatedState(matviewRel, !skipData); /* Concurrent refresh builds new data in temp tablespace, and does diff. */ if (concurrent) -- 2.43.0