Fix a couple of error messages and tests for them

oversights in 1495eff7bdb and 289f74d0cb2. Mea culpa.
This commit is contained in:
Andrew Dunstan 2025-04-04 17:02:02 -04:00
parent 8ec0aaeae0
commit 2ef5790806
3 changed files with 7 additions and 7 deletions

View File

@ -505,9 +505,9 @@ main(int argc, char **argv)
* dump.
*/
if (opts->tocSummary)
pg_fatal("option -l/--list cannot be used when restoring an archive created with pg_dumpall");
pg_fatal("option -l/--list cannot be used when restoring an archive created by pg_dumpall");
else if (opts->tocFile)
pg_fatal("option -L/--use-list cannot be used when restoring an archive created with pg_dumpall");
pg_fatal("option -L/--use-list cannot be used when restoring an archive created by pg_dumpall");
/*
* To restore from a pg_dumpall archive, -C (create database) option
@ -515,7 +515,7 @@ main(int argc, char **argv)
*/
if (!globals_only && opts->createDB != 1)
{
pg_log_error("-C/--create option should be specified when restoring from an archive of created by pg_dumpall");
pg_log_error("-C/--create option should be specified when restoring an archive created by pg_dumpall");
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
pg_log_error_hint("Individual databases can be restored using their specific archives.");
exit_nicely(1);

View File

@ -244,12 +244,12 @@ command_fails_like(
command_fails_like(
[ 'pg_restore', '--exclude-database=foo', '-d', 'xxx', 'dumpdir' ],
qr/\Qpg_restore: error: option --exclude-database can be used only when restoring multiple databases by archive of pg_dumpall\E/,
qr/\Qpg_restore: error: option --exclude-database can be used only when restoring an archive created by pg_dumpall\E/,
'When option --exclude-database is used in pg_restore with dump of pg_dump');
command_fails_like(
[ 'pg_restore', '--globals-only', '-d', 'xxx', 'dumpdir' ],
qr/\Qpg_restore: error: option -g\/--globals-only can be used only when restoring multiple databases by archive of pg_dumpall\E/,
qr/\Qpg_restore: error: option -g\/--globals-only can be used only when restoring an archive created by pg_dumpall\E/,
'When option --globals-only is not used in pg_restore with dump of pg_dump');
# also fails for -r and -t, but it seems pointless to add more tests for those.

View File

@ -365,7 +365,7 @@ $node->command_fails_like(
"$tempdir/format_custom",
'--format' => 'custom',
'--file' => "$tempdir/error_test.sql", ],
qr/\Qpg_restore: error: -C\/--create option should be specified when restoring multiple databases by archive of pg_dumpall\E/,
qr/\Qpg_restore: error: -C\/--create option should be specified when restoring an archive created by pg_dumpall\E/,
'When -C is not used in pg_restore with dump of pg_dumpall');
# test case 2: When --list option is used with dump of pg_dumpall
@ -374,7 +374,7 @@ $node->command_fails_like(
"$tempdir/format_custom", '-C',
'--format' => 'custom', '--list',
'--file' => "$tempdir/error_test.sql", ],
qr/\Qpg_restore: error: option -l\/--list cannot be used when restoring multiple databases by archive of pg_dumpall\E/,
qr/\Qpg_restore: error: option -l\/--list cannot be used when restoring an archive created by pg_dumpall\E/,
'When --list is used in pg_restore with dump of pg_dumpall');
# test case 3: When non-exist database is given with -d option