When creating materialized views, use REFRESH to load data.
[pgsql.git] / src / bin / scripts / t / 010_clusterdb.pl
blobaa3bb291b2141462ae4daef9224c5d24534de8b4
2 # Copyright (c) 2021-2024, PostgreSQL Global Development Group
4 use strict;
5 use warnings FATAL => 'all';
7 use PostgreSQL::Test::Cluster;
8 use PostgreSQL::Test::Utils;
9 use Test::More;
11 program_help_ok('clusterdb');
12 program_version_ok('clusterdb');
13 program_options_handling_ok('clusterdb');
15 my $node = PostgreSQL::Test::Cluster->new('main');
16 $node->init;
17 $node->start;
19 $node->issues_sql_like(
20 ['clusterdb'],
21 qr/statement: CLUSTER;/,
22 'SQL CLUSTER run');
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');
38 done_testing();