v20231113-0003-add-more-tests-related-to-unsupported-options-of-pg_.patch
text/x-patch
Filename: v20231113-0003-add-more-tests-related-to-unsupported-options-of-pg_.patch
Type: text/x-patch
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v20231113-0003
Subject: add more tests related to unsupported options of pg_restore
| File | + | − |
|---|---|---|
| src/bin/pg_dump/t/005_pg_dump_filterfile.pl | 57 | 1 |
From 13984bc6ca65b20c4a23a65602304ab0bf11c955 Mon Sep 17 00:00:00 2001 From: "okbob@github.com" <pavel.stehule@gmail.com> Date: Mon, 13 Nov 2023 08:26:22 +0100 Subject: [PATCH 3/4] add more tests related to unsupported options of pg_restore --- src/bin/pg_dump/t/005_pg_dump_filterfile.pl | 58 ++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_dump/t/005_pg_dump_filterfile.pl b/src/bin/pg_dump/t/005_pg_dump_filterfile.pl index a0aee12543..09d3262b8b 100644 --- a/src/bin/pg_dump/t/005_pg_dump_filterfile.pl +++ b/src/bin/pg_dump/t/005_pg_dump_filterfile.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 98; +use Test::More tests => 106; my $tempdir = PostgreSQL::Test::Utils::tempdir;; my $inputfile; @@ -535,6 +535,62 @@ $dump = slurp_file($plainfile); ok($dump =~ qr/^CREATE TABLE public\.table_two/m, "wanted table restored"); ok($dump !~ qr/^CREATE TABLE public\.table_one/m, "unwanted table is not restored"); +open $inputfile, '>', "$tempdir/inputfile.txt" + or die "unable to open filterfile for writing"; +print $inputfile "include table_data xxx"; +close $inputfile; + +command_fails_like( + [ + 'pg_restore', '-p', $port, '-f', $plainfile, + "--filter=$tempdir/inputfile.txt" + ], + qr/include filter for "table data" is not allowed/, + "invalid syntax: inclusion of non allowed object" +); + +open $inputfile, '>', "$tempdir/inputfile.txt" + or die "unable to open filterfile for writing"; +print $inputfile "include extension xxx"; +close $inputfile; + +command_fails_like( + [ + 'pg_restore', '-p', $port, '-f', $plainfile, + "--filter=$tempdir/inputfile.txt" + ], + qr/include filter for "extension" is not allowed/, + "invalid syntax: inclusion of non allowed object" +); + +open $inputfile, '>', "$tempdir/inputfile.txt" + or die "unable to open filterfile for writing"; +print $inputfile "exclude extension xxx"; +close $inputfile; + +command_fails_like( + [ + 'pg_restore', '-p', $port, '-f', $plainfile, + "--filter=$tempdir/inputfile.txt" + ], + qr/exclude filter for "extension" is not allowed/, + "invalid syntax: exclusion of non allowed object" +); + +open $inputfile, '>', "$tempdir/inputfile.txt" + or die "unable to open filterfile for writing"; +print $inputfile "exclude table_data xxx"; +close $inputfile; + +command_fails_like( + [ + 'pg_restore', '-p', $port, '-f', $plainfile, + "--filter=$tempdir/inputfile.txt" + ], + qr/xclude filter for "table data" is not allowed/, + "invalid syntax: exclusion of non allowed object" +); + ######################################### # test restore of other objects -- 2.41.0