diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index f357c5731491a4fc4afcbb50300ac665b7dcbedb..9d7434d401a251eafc09e76343c2249fe686d864 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -165,8 +165,8 @@ <listitem> <para> Specify output file for generated script, or for the listing - when used with <option>-l</option>. Default is the standard - output. + when used with <option>-l</option>. Use <literal>-</literal> + for the standard output, which is also the default. </para> </listitem> </varlistentry> diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 18cde557fb4e1cdc624a4ffc27c8230fe42093a7..c5eaee039be6e8398c68263c552fd8d26aa3824a 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -1500,7 +1500,12 @@ SetOutput(ArchiveHandle *AH, const char *filename, int compression) int fn; if (filename) - fn = -1; + { + if (strcmp(filename, "-") == 0) + fn = fileno(stdout); + else + fn = -1; + } else if (AH->FH) fn = fileno(AH->FH); else if (AH->fSpec) diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index f9fb12c2d6b6eede36c02c7829cd791a8c417b0d..c27c095fe20977f9351555d744046d5da625b4fc 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -442,7 +442,7 @@ usage(const char *progname) printf(_("\nGeneral options:\n")); printf(_(" -d, --dbname=NAME connect to database name\n")); - printf(_(" -f, --file=FILENAME output file name\n")); + printf(_(" -f, --file=FILENAME output file name (- for stdout)\n")); printf(_(" -F, --format=c|d|t backup file format (should be automatic)\n")); printf(_(" -l, --list print summarized TOC of the archive\n")); printf(_(" -v, --verbose verbose mode\n"));