Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0803b0a

Browse files
committed
Add TAP tests for vacuumdb with column lists
vacuumdb generates by itself SQL queries to run ANALYZE or VACUUM on the backend, but we never actually checked for query patterns with column lists defined. Author: Michael Paquier Reviewed-by: Nathan Bossart Discussion: https://postgr.es/m/FFE5373C-E26A-495B-B5C8-911EC4A41C5E@amazon.com
1 parent d6f6f0f commit 0803b0a

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/bin/scripts/t/100_vacuumdb.pl

+14-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use PostgresNode;
55
use TestLib;
6-
use Test::More tests => 30;
6+
use Test::More tests => 35;
77

88
program_help_ok('vacuumdb');
99
program_version_ok('vacuumdb');
@@ -63,6 +63,7 @@
6363
$node->safe_psql(
6464
'postgres', q|
6565
CREATE TABLE "need""q(uot" (")x" text);
66+
CREATE TABLE vactable (a int, b int);
6667
6768
CREATE FUNCTION f0(int) RETURNS int LANGUAGE SQL AS 'SELECT $1 * $1';
6869
CREATE FUNCTION f1(int) RETURNS int LANGUAGE SQL AS 'SELECT f0($1)';
@@ -75,3 +76,15 @@
7576
$node->command_fails(
7677
[qw|vacuumdb -Zt funcidx postgres|],
7778
'unqualifed name via functional index');
79+
80+
$node->command_fails(
81+
[ 'vacuumdb', '--analyze', '--table', 'vactable(c)', 'postgres' ],
82+
'incorrect column name with ANALYZE');
83+
$node->issues_sql_like(
84+
[ 'vacuumdb', '--analyze', '--table', 'vactable(a, b)', 'postgres' ],
85+
qr/statement: VACUUM \(ANALYZE\) public.vactable\(a, b\);/,
86+
'vacuumdb --analyze with complete column list');
87+
$node->issues_sql_like(
88+
[ 'vacuumdb', '--analyze-only', '--table', 'vactable(b)', 'postgres' ],
89+
qr/statement: ANALYZE public.vactable\(b\);/,
90+
'vacuumdb --analyze-only with partial column list');

0 commit comments

Comments
 (0)