Re: Non-text mode for pg_dumpall

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Subject: Re: Non-text mode for pg_dumpall
Date: 2025-01-20 16:01:42
Message-ID: CACJufxHNNjAhVYJQS8x5U-9Fqsj6+tzG4uCivk2XTAOPTmstTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.
some minor issues come to my mind when I look at it again.

looking at set_null_conf,
i think "if (archDumpFormat != archNull)" can be:

if (archDumpFormat != archNull)
{
OPF = fopen(toc_path, "w");
if (!OPF)
pg_fatal("could not open global.dat file: \"%s\" for writing: %m",
toc_path);
}

some places we use ``fopen(filename, PG_BINARY_W)``,
some places we use ``fopen(filename, "w");``
kind of inconsistent...

+ printf(_(" -F, --format=c|d|t|p output file format
(custom, directory, tar,\n"
+ " plain text (default))\n"));
this indentation level is not right?
if we look closely at the surrounding output of `pg_dumpall --help`.

pg_dump.sgml --create option description:
This option is ignored when emitting an archive (non-text) output file. For the
archive formats, you can specify the option when you call pg_restore.

in runPgDump, we have:
/*
* If this is non-plain format dump, then append file name and dump
* format to the pg_dump command to get archive dump.
*/
if (archDumpFormat != archNull)
{
printfPQExpBuffer(&cmd, "\"%s\" -f %s %s", pg_dump_bin,
dbfile, create_opts);
...
}

so in here, create_opts is not necessary per pg_dump.sgml above description.
we can simplify it as:

if (archDumpFormat != archNull)
{
printfPQExpBuffer(&cmd, "\"%s\" --file=%s", pg_dump_bin, dbfile);
}
?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ivan Kush 2025-01-20 16:14:07 Re: pg_stat_statements: improve loading and saving routines for the dump file
Previous Message Corey Huinker 2025-01-20 15:58:30 Re: Statistics Import and Export