v5-0001-Add-tests-for-using-vacuumdb-with-column-lists-pr.patch

application/octet-stream

Filename: v5-0001-Add-tests-for-using-vacuumdb-with-column-lists-pr.patch
Type: application/octet-stream
Part: 0
Message: Re: A few new options for vacuumdb

Patch

Format: format-patch
Series: patch v5-0001
Subject: Add tests for using vacuumdb with column lists provided.
File+
src/bin/scripts/t/100_vacuumdb.pl 14 1
From 33305f7506be52ad1926d34d4413db9d4cd48472 Mon Sep 17 00:00:00 2001
From: Nathan Bossart <bossartn@amazon.com>
Date: Wed, 23 Jan 2019 22:07:01 +0000
Subject: [PATCH v5 1/4] Add tests for using vacuumdb with column lists
 provided.

---
 src/bin/scripts/t/100_vacuumdb.pl | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl
index 951202b40e..ff0d97971b 100644
--- a/src/bin/scripts/t/100_vacuumdb.pl
+++ b/src/bin/scripts/t/100_vacuumdb.pl
@@ -3,7 +3,7 @@ use warnings;
 
 use PostgresNode;
 use TestLib;
-use Test::More tests => 30;
+use Test::More tests => 35;
 
 program_help_ok('vacuumdb');
 program_version_ok('vacuumdb');
@@ -63,6 +63,7 @@ $node->command_ok(
 $node->safe_psql(
 	'postgres', q|
   CREATE TABLE "need""q(uot" (")x" text);
+  CREATE TABLE vactable (a int, b int);
 
   CREATE FUNCTION f0(int) RETURNS int LANGUAGE SQL AS 'SELECT $1 * $1';
   CREATE FUNCTION f1(int) RETURNS int LANGUAGE SQL AS 'SELECT f0($1)';
@@ -75,3 +76,15 @@ $node->command_ok([qw|vacuumdb -Z --table="need""q(uot"(")x") postgres|],
 $node->command_fails(
 	[qw|vacuumdb -Zt funcidx postgres|],
 	'unqualifed name via functional index');
+
+$node->command_fails(
+	[ 'vacuumdb', '--analyze', '--table', 'vactable(c)', 'postgres' ],
+	'incorrect column name with ANALYZE');
+$node->issues_sql_like(
+	[ 'vacuumdb', '--analyze', '--table', 'vactable(a, b)', 'postgres' ],
+	qr/statement: VACUUM \(ANALYZE\) public.vactable\(a, b\);/,
+	'vacuumdb --analyze with complete column list');
+$node->issues_sql_like(
+	[ 'vacuumdb', '--analyze-only', '--table', 'vactable(b)', 'postgres' ],
+	qr/statement: ANALYZE public.vactable\(b\);/,
+	'vacuumdb --analyze-only with partial column list');
-- 
2.16.5