mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-23 20:27:19 +02:00
Change pg_restore -f- to dump to stdout instead of to ./-
Starting with PostgreSQL 12, pg_restore refuses to run when neither -d
nor -f are specified (c.f. commit 413ccaa74d
), and it also makes "-f -"
mean the old implicit behavior of dumping to stdout. However, older
branches write to a file called ./- when invoked like that, making it
impossible to write pg_restore scripts that work across versions. This
is a partial backpatch of the aforementioned commit to all older
supported branches, providing an upgrade path.
Discussion: https://postgr.es/m/20191006190839.GE18030@telsasoft.com
This commit is contained in:
parent
8f8ff09d49
commit
3574c0ac05
@ -176,8 +176,8 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Specify output file for generated script, or for the listing
|
Specify output file for generated script, or for the listing
|
||||||
when used with <option>-l</option>. Default is the standard
|
when used with <option>-l</option>. Use <literal>-</literal>
|
||||||
output.
|
for the standard output, which is also the default.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
@ -1511,7 +1511,12 @@ SetOutput(ArchiveHandle *AH, const char *filename, int compression)
|
|||||||
int fn;
|
int fn;
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
|
{
|
||||||
|
if (strcmp(filename, "-") == 0)
|
||||||
|
fn = fileno(stdout);
|
||||||
|
else
|
||||||
fn = -1;
|
fn = -1;
|
||||||
|
}
|
||||||
else if (AH->FH)
|
else if (AH->FH)
|
||||||
fn = fileno(AH->FH);
|
fn = fileno(AH->FH);
|
||||||
else if (AH->fSpec)
|
else if (AH->fSpec)
|
||||||
|
@ -454,7 +454,7 @@ usage(const char *progname)
|
|||||||
|
|
||||||
printf(_("\nGeneral options:\n"));
|
printf(_("\nGeneral options:\n"));
|
||||||
printf(_(" -d, --dbname=NAME connect to database name\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(_(" -F, --format=c|d|t backup file format (should be automatic)\n"));
|
||||||
printf(_(" -l, --list print summarized TOC of the archive\n"));
|
printf(_(" -l, --list print summarized TOC of the archive\n"));
|
||||||
printf(_(" -v, --verbose verbose mode\n"));
|
printf(_(" -v, --verbose verbose mode\n"));
|
||||||
|
Loading…
Reference in New Issue
Block a user