]> granicus.if.org Git - postgresql/blob - src/bin/scripts/t/090_reindexdb.pl
Empty search_path in Autovacuum and non-psql/pgbench clients.
[postgresql] / src / bin / scripts / t / 090_reindexdb.pl
1 use strict;
2 use warnings;
3
4 use PostgresNode;
5 use TestLib;
6 use Test::More tests => 23;
7
8 program_help_ok('reindexdb');
9 program_version_ok('reindexdb');
10 program_options_handling_ok('reindexdb');
11
12 my $node = get_new_node('main');
13 $node->init;
14 $node->start;
15
16 $ENV{PGOPTIONS} = '--client-min-messages=WARNING';
17
18 $node->issues_sql_like(
19         [ 'reindexdb', 'postgres' ],
20         qr/statement: REINDEX DATABASE postgres;/,
21         'SQL REINDEX run');
22
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');
45
46 $node->command_ok([qw(reindexdb --echo --table=pg_am dbname=template1)],
47         'reindexdb table with connection string');
48 $node->command_ok(
49         [qw(reindexdb --echo dbname=template1)],
50         'reindexdb database with connection string');
51 $node->command_ok(
52         [qw(reindexdb --echo --system dbname=template1)],
53         'reindexdb system with connection string');