Re: Non-text mode for pg_dumpall
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Mahendra Singh Thalor <mahi6run@gmail.com>
Cc: Guillaume Lelarge <guillaume@lelarge.info>,
Nathan Bossart <nathandbossart@gmail.com>, Magnus Hagander <magnus@hagander.net>, Tom Lane <tgl@sss.pgh.pa.us>, Andrew Dunstan <andrew@dunslane.net>,
PostgreSQL-development <pgsql-hackers@postgresql.org>, Dilip Kumar <dilipbalaut@gmail.com>
Date: 2025-01-11T05:48:27Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add non-text output formats to pg_dumpall
- 763aaa06f034 19 (unreleased) landed
-
Improve pg_dump/pg_dumpall help synopses and terminology
- dec6643487bb 18.0 cited
-
Non text modes for pg_dumpall, correspondingly change pg_restore
- 1495eff7bdb0 18.0 landed
-
Doc: manually break lines in wide UUID examples.
- a6524105d20b 18.0 cited
Attachments
- v7-0001-misc-tests-for-pg_dumpall.no-cfbot (application/octet-stream)
in src/bin/pg_dump/pg_dumpall.c main
i think you need do
archDumpFormat = parseDumpFormat(formatName);
/*
* Open the output file if required, otherwise use stdout. If required,
* then create new files with global.dat and map.dat names.
*/
if (archDumpFormat != archNull)
{
char toc_path[MAXPGPATH];
/*
* If directory/tar/custom format is specified then we must provide the
* file name to create one main directory.
*/
if (!filename || strcmp(filename, "") == 0)
pg_fatal("no output directory specified");
/* TODO: accept the empty existing directory. */
if (mkdir(filename, 0700) < 0)
pg_fatal("could not create directory \"%s\": %m",
filename);
snprintf(toc_path, MAXPGPATH, "%s/global.dat", filename);
OPF = fopen(toc_path, "w");
if (!OPF)
pg_fatal("could not open global.dat file: %s", strerror(errno));
}
else if (filename)
{
OPF = fopen(filename, PG_BINARY_W);
if (!OPF)
pg_fatal("could not open output file \"%s\": %m",
filename);
}
else
OPF = stdout;
before connectDatabase call.
otherwise if the cluster is not setting up.
``pg_dumpall --format=d``
error would be about connection error, not
"pg_dumpall: error: no output directory specified"
we want ``pg_dumpall --format`` invalid options
to error out even if the cluster is not setting up.
attached are two invalid option test cases.
you also need change
<varlistentry>
<term><option>-f <replaceable
class="parameter">filename</replaceable></option></term>
<term><option>--file=<replaceable
class="parameter">filename</replaceable></option></term>
<listitem>
<para>
Send output to the specified file. If this is omitted, the
standard output is used.
</para>
</listitem>
</varlistentry>
?
since if --format=d,
<option>--file=<replaceable class="parameter">filename</replaceable></option>
can not be omitted.