Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3574c0a

Browse files
committed
Change pg_restore -f- to dump to stdout instead of to ./-
Starting with PostgreSQL 12, pg_restore refuses to run when neither -dnor -f are specified (c.f. commit413ccaa), and it also makes "-f -"mean the old implicit behavior of dumping to stdout. However, olderbranches write to a file called ./- when invoked like that, making itimpossible to write pg_restore scripts that work across versions. Thisis a partial backpatch of the aforementioned commit to all oldersupported branches, providing an upgrade path.Discussion:https://postgr.es/m/20191006190839.GE18030@telsasoft.com
1 parent8f8ff09 commit3574c0a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

‎doc/src/sgml/ref/pg_restore.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@
176176
<listitem>
177177
<para>
178178
Specify output file for generated script, or for the listing
179-
when used with <option>-l</option>.Default is the standard
180-
output.
179+
when used with <option>-l</option>.Use <literal>-</literal>
180+
for the standardoutput, which is also the default.
181181
</para>
182182
</listitem>
183183
</varlistentry>

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,12 @@ SetOutput(ArchiveHandle *AH, const char *filename, int compression)
15111511
intfn;
15121512

15131513
if (filename)
1514-
fn=-1;
1514+
{
1515+
if (strcmp(filename,"-")==0)
1516+
fn=fileno(stdout);
1517+
else
1518+
fn=-1;
1519+
}
15151520
elseif (AH->FH)
15161521
fn=fileno(AH->FH);
15171522
elseif (AH->fSpec)

‎src/bin/pg_dump/pg_restore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ usage(const char *progname)
454454

455455
printf(_("\nGeneral options:\n"));
456456
printf(_(" -d, --dbname=NAME connect to database name\n"));
457-
printf(_(" -f, --file=FILENAME output file name\n"));
457+
printf(_(" -f, --file=FILENAME output file name (- for stdout)\n"));
458458
printf(_(" -F, --format=c|d|t backup file format (should be automatic)\n"));
459459
printf(_(" -l, --list print summarized TOC of the archive\n"));
460460
printf(_(" -v, --verbose verbose mode\n"));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp