2 # Copyright (c) 2021-2025, PostgreSQL Global Development Group
5 use warnings FATAL
=> 'all';
7 use PostgreSQL
::Test
::Cluster
;
8 use PostgreSQL
::Test
::Utils
;
11 my $tempdir = PostgreSQL
::Test
::Utils
::tempdir
;
13 my $node = PostgreSQL
::Test
::Cluster
->new('main');
14 my $port = $node->port;
19 #########################################
20 # Verify that dumping foreign data includes only foreign tables of
23 $node->safe_psql('postgres', "CREATE FOREIGN DATA WRAPPER dummy");
24 $node->safe_psql('postgres', "CREATE SERVER s0 FOREIGN DATA WRAPPER dummy");
25 $node->safe_psql('postgres', "CREATE SERVER s1 FOREIGN DATA WRAPPER dummy");
26 $node->safe_psql('postgres', "CREATE SERVER s2 FOREIGN DATA WRAPPER dummy");
27 $node->safe_psql('postgres', "CREATE FOREIGN TABLE t0 (a int) SERVER s0");
28 $node->safe_psql('postgres', "CREATE FOREIGN TABLE t1 (a int) SERVER s1");
31 [ "pg_dump", '-p', $port, '--include-foreign-data=s0', 'postgres' ],
32 qr/foreign-data wrapper \"dummy\" has no handler\r?\npg_dump: detail: Query was: .*t0/,
33 "correctly fails to dump a foreign table from a dummy FDW");
36 [ "pg_dump", '-p', $port, '-a', '--include-foreign-data=s2', 'postgres' ],
37 "dump foreign server with no tables");