6 use Test::More tests => 23;
8 program_help_ok('reindexdb');
9 program_version_ok('reindexdb');
10 program_options_handling_ok('reindexdb');
12 my $node = get_new_node('main');
16 $ENV{PGOPTIONS} = '--client-min-messages=WARNING';
18 $node->issues_sql_like(
19 [ 'reindexdb', 'postgres' ],
20 qr/statement: REINDEX DATABASE postgres;/,
23 $node->safe_psql('postgres',
24 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);');
25 $node->issues_sql_like(
26 [ 'reindexdb', '-t', 'test1', 'postgres' ],
27 qr/statement: REINDEX TABLE public\.test1;/,
28 'reindex specific table');
29 $node->issues_sql_like(
30 [ 'reindexdb', '-i', 'test1x', 'postgres' ],
31 qr/statement: REINDEX INDEX public\.test1x;/,
32 'reindex specific index');
33 $node->issues_sql_like(
34 [ 'reindexdb', '-S', 'pg_catalog', 'postgres' ],
35 qr/statement: REINDEX SCHEMA pg_catalog;/,
36 'reindex specific schema');
37 $node->issues_sql_like(
38 [ 'reindexdb', '-s', 'postgres' ],
39 qr/statement: REINDEX SYSTEM postgres;/,
40 'reindex system tables');
41 $node->issues_sql_like(
42 [ 'reindexdb', '-v', '-t', 'test1', 'postgres' ],
43 qr/statement: REINDEX \(VERBOSE\) TABLE public\.test1;/,
44 'reindex with verbose output');
46 $node->command_ok([qw(reindexdb --echo --table=pg_am dbname=template1)],
47 'reindexdb table with connection string');
49 [qw(reindexdb --echo dbname=template1)],
50 'reindexdb database with connection string');
52 [qw(reindexdb --echo --system dbname=template1)],
53 'reindexdb system with connection string');