summaryrefslogtreecommitdiff
path: root/src/bin/scripts/t
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2025-08-22 11:11:28 -0500
committerNathan Bossart <nathan@postgresql.org>2025-08-22 11:11:28 -0500
commitb63952a7811319a6525a9ea23afa294a900fa895 (patch)
treea2ae1f3c77818724a34e47a0e99e6ab8fb8c37ee /src/bin/scripts/t
parent807ee417e562c355360e891f415e6e8e6e4c40ed (diff)
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@sraoss.co.jp> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Corey Huinker <corey.huinker@gmail.com> Discussion: https://postgr.es/m/20250820104226.8ba51e43164cd590b863ce41%40sraoss.co.jp Backpatch-through: 18
Diffstat (limited to 'src/bin/scripts/t')
-rw-r--r--src/bin/scripts/t/100_vacuumdb.pl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl
index 240f0fdd3e5..945c30df156 100644
--- a/src/bin/scripts/t/100_vacuumdb.pl
+++ b/src/bin/scripts/t/100_vacuumdb.pl
@@ -237,9 +237,10 @@ $node->command_fails_like(
qr/cannot vacuum all databases and a specific one at the same time/,
'cannot use option --all and a dbname as argument at the same time');
-$node->safe_psql('postgres',
- 'CREATE TABLE regression_vacuumdb_test AS select generate_series(1, 10) a, generate_series(2, 11) b;'
-);
+$node->safe_psql('postgres', q|
+ CREATE TABLE regression_vacuumdb_test AS select generate_series(1, 10) a, generate_series(2, 11) b;
+ ALTER TABLE regression_vacuumdb_test ADD COLUMN c INT GENERATED ALWAYS AS (a + b);
+|);
$node->issues_sql_like(
[
'vacuumdb', '--analyze-only',