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

Commit5ee8f0f

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 parentf5efc93 commit5ee8f0f

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
@@ -165,8 +165,8 @@
165165
<listitem>
166166
<para>
167167
Specify output file for generated script, or for the listing
168-
when used with <option>-l</option>.Default is the standard
169-
output.
168+
when used with <option>-l</option>.Use <literal>-</literal>
169+
for the standardoutput, which is also the default.
170170
</para>
171171
</listitem>
172172
</varlistentry>

‎src/bin/pg_dump/pg_backup_archiver.c

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

15251525
if (filename)
1526-
fn=-1;
1526+
{
1527+
if (strcmp(filename,"-")==0)
1528+
fn=fileno(stdout);
1529+
else
1530+
fn=-1;
1531+
}
15271532
elseif (AH->FH)
15281533
fn=fileno(AH->FH);
15291534
elseif (AH->fSpec)

‎src/bin/pg_dump/pg_restore.c

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

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp