pgsql: vacuumdb: Fix --missing-stats-only with virtual generated column

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: vacuumdb: Fix --missing-stats-only with virtual generated column
Date: 2025-08-22 16:12:09
Message-ID: E1upUN6-0019eW-2G@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

vacuumdb: Fix --missing-stats-only with virtual generated columns.

Statistics aren't created for virtual generated columns, so
"vacuumdb --missing-stats-only" always chooses to analyze tables
that have them. To fix, modify vacuumdb's query for retrieving
relations that are missing statistics to exclude those columns.

Oversight in commit edba754f05.

Author: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Discussion: https://postgr.es/m/20250820104226.8ba51e43164cd590b863ce41%40sraoss.co.jp
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b63952a7811319a6525a9ea23afa294a900fa895

Modified Files
--------------
src/bin/scripts/t/100_vacuumdb.pl | 7 ++++---
src/bin/scripts/vacuumdb.c | 5 +++++
2 files changed, 9 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2025-08-22 16:31:46 pgsql: Revert "Get rid of WALBufMappingLock"
Previous Message Heikki Linnakangas 2025-08-22 11:52:11 pgsql: Revert unnecessary check for NULL