aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-01-27 22:25:48 +0900
committerMichael Paquier <michael@paquier.xyz>2019-01-27 22:25:48 +0900
commit0803b0ae1ed6e5825eee4d1ba227e96cd8a328d8 (patch)
treedb89419ea180e90d108269f560c71decfc7b7bce
parentd6f6f0fc2d84906985b21d959622e4cab6f8f9b1 (diff)
downloadpostgresql-0803b0ae1ed6e5825eee4d1ba227e96cd8a328d8.tar.gz
postgresql-0803b0ae1ed6e5825eee4d1ba227e96cd8a328d8.zip
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
-rw-r--r--src/bin/scripts/t/100_vacuumdb.pl15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl
index 951202b40e3..ff0d97971bd 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');