1 # Copyright (c) 2021-2024, PostgreSQL Global Development Group
4 use warnings FATAL
=> 'all';
6 use PostgreSQL
::Test
::Cluster
;
7 use PostgreSQL
::Test
::Utils
;
10 # Set up a new database instance.
11 my $primary = PostgreSQL
::Test
::Cluster
->new('primary');
12 $primary->init(has_archiving
=> 1, allows_streaming
=> 1);
13 $primary->append_conf('postgresql.conf', 'summarize_wal = on');
17 $primary->safe_psql('postgres', <<EOM);
18 CREATE DATABASE lakh OID = 100000 STRATEGY = FILE_COPY
20 $primary->safe_psql('lakh', <<EOM);
21 CREATE TABLE t1 (a int)
25 my $backup1path = $primary->backup_dir . '/backup1';
27 [ 'pg_basebackup', '-D', $backup1path, '--no-sync', '-cfast' ],
30 # Now make some database changes.
31 $primary->safe_psql('postgres', <<EOM);
33 CREATE DATABASE lakh OID = 100000 STRATEGY = FILE_COPY
36 # Take an incremental backup.
37 my $backup2path = $primary->backup_dir . '/backup2';
40 'pg_basebackup', '-D', $backup2path, '--no-sync', '-cfast',
41 '--incremental', $backup1path . '/backup_manifest'
43 "incremental backup");
45 # Recover the incremental backup.
46 my $restore = PostgreSQL
::Test
::Cluster
->new('restore');
47 $restore->init_from_backup($primary, 'backup2',
48 combine_with_prior
=> ['backup1']);
55 'lakh', 'SELECT * FROM t1',
58 is
($stdout, '', 'SELECT * FROM t1: no stdout');
61 qr/relation "t1" does not exist/,
62 'SELECT * FROM t1: stderr missing table');