]> granicus.if.org Git - postgresql/blob - src/bin/scripts/t/010_clusterdb.pl
dc0d78a27d374edecf3682c3e19ae16ec8721fdd
[postgresql] / src / bin / scripts / t / 010_clusterdb.pl
1 use strict;
2 use warnings;
3 use TestLib;
4 use Test::More tests => 13;
5
6 program_help_ok('clusterdb');
7 program_version_ok('clusterdb');
8 program_options_handling_ok('clusterdb');
9
10 my $tempdir = tempdir;
11 start_test_server $tempdir;
12
13 issues_sql_like(
14         [ 'clusterdb', 'postgres' ],
15         qr/statement: CLUSTER;/,
16         'SQL CLUSTER run');
17
18 command_fails([ 'clusterdb', '-t', 'nonexistent', 'postgres' ],
19         'fails with nonexistent table');
20
21 psql 'postgres',
22 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x';
23 issues_sql_like(
24         [ 'clusterdb', '-t', 'test1', 'postgres' ],
25         qr/statement: CLUSTER test1;/,
26         'cluster specific table');