From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't lose partitioned table reltuples=0 after relhassubclass=f.
Date: Sat, 13 Jul 2024 15:11:06 +0000
Message-ID: <E1sSeOw-001VzD-3A@gemulon.postgresql.org> (raw)
Don't lose partitioned table reltuples=0 after relhassubclass=f.
ANALYZE sets relhassubclass=f when a partitioned table no longer has
partitions. An ANALYZE doing that proceeded to apply the inplace update
of pg_class.reltuples to the old pg_class tuple instead of the new
tuple, losing that reltuples=0 change if the ANALYZE committed.
Non-partitioning inheritance trees were unaffected. Back-patch to v14,
where commit 375aed36ad83f0e021e9bdd3a0034c0c992c66dc introduced
maintenance of partitioned table pg_class.reltuples.
Reported by Alexander Lakhin.
Discussion: https://postgr.es/m/a295b499-dcab-6a99-c06e-01cf60593344@gmail.com
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/e81deeefcac2a0de06f51e82405f63935f00e2bc
Modified Files
--------------
src/backend/commands/analyze.c | 7 +++++-
src/test/regress/expected/vacuum.out | 47 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/vacuum.sql | 29 ++++++++++++++++++++++
3 files changed, 82 insertions(+), 1 deletion(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Don't lose partitioned table reltuples=0 after relhassubclass=f.
In-Reply-To: <E1sSeOw-001VzD-3A@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox