2 # Copyright (c) 2021-2024, PostgreSQL Global Development Group
5 use warnings FATAL
=> 'all';
7 use PostgreSQL
::Test
::Cluster
;
8 use PostgreSQL
::Test
::Utils
;
11 program_help_ok
('clusterdb');
12 program_version_ok
('clusterdb');
13 program_options_handling_ok
('clusterdb');
15 my $node = PostgreSQL
::Test
::Cluster
->new('main');
19 $node->issues_sql_like(
21 qr/statement: CLUSTER;/,
24 $node->command_fails([ 'clusterdb', '-t', 'nonexistent' ],
25 'fails with nonexistent table');
27 $node->safe_psql('postgres',
28 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x'
30 $node->issues_sql_like(
31 [ 'clusterdb', '-t', 'test1' ],
32 qr/statement: CLUSTER public\.test1;/,
33 'cluster specific table');
35 $node->command_ok([qw(clusterdb --echo --verbose dbname=template1)],
36 'clusterdb with connection string');