Re: Non-text mode for pg_dumpall
Mahendra Singh Thalor <mahi6run@gmail.com>
From: Mahendra Singh Thalor <mahi6run@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
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-11T21:30:52Z
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
- v08_pg_dumpall-with-directory-tar-custom-format-12-jan.patch (application/octet-stream) patch v8
Thanks Alvaro and Jian for the review. > > 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. Fixed. Apart from this, added handling to support empty directory also with --file option. > > 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. No, we don't need this change. With --fromat=d, we can omit the --file option. > On Sat, 11 Jan 2025 at 14:14, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote: > > Hmm, this patch adds a function connectDatabase() to pg_restore, but a > function that's almost identical already exists in pg_dumpall. I > suggest they should be unified. Maybe create a new file for connection > management routines? (since this clearly doesn't fit common.c nor > dumputils.c). I will make a new file in follow-up patches. > On Sat, 11 Jan 2025 at 21:38, Mahendra Singh Thalor <mahi6run@gmail.com> wrote: > > > On Sat, 11 Jan 2025 at 9:30 PM, jian he <jian.universality@gmail.com> wrote: >> >> hi. >> the following two tests, you can add to src/bin/pg_dump/t/001_basic.pl >> >> command_fails_like( >> [ 'pg_restore', '--globals-only', '-f', 'xxx' ], >> qr/\Qpg_restore: error: option -g\/--globals-only requires option >> -d\/--dbname\E/, >> 'pg_restore: error: option -g/--globals-only requires option -d/--dbname' I removed this error form code as we can dump global sql commands in file also. >> ); >> command_fails_like( >> [ 'pg_restore', '--globals-only', '--file=xxx', '--exclude-database=x',], >> qr/\Qpg_restore: error: option --exclude-database cannot be used >> together with -g\/--globals-only\E/, >> 'pg_restore: error: option --exclude-database cannot be used >> together with -g/--globals-only' >> ); Fixed. >> >> >> in pg_restore.sgml. >> <varlistentry> >> <term><option>--exclude-database=<replaceable >> class="parameter">pattern</replaceable></option></term> >> <listitem> >> the position should right after >> <varlistentry> >> <term><option>-d <replaceable >> class="parameter">dbname</replaceable></option></term> >> <term><option>--dbname=<replaceable >> class="parameter">dbname</replaceable></option></term> Fixed. >> >> >> should >> pg_restore --globals-only >> pg_restore --exclude-database=pattern >> be in a separate patch? I think we can keep these 2 options in one patch only as both are for pg_restore and there are not many code changes. If we want, we can make separate patches for pg_dumpall and pg_restore options. >> >> >> i am also wondering what will happen: >> pg_restore --exclude-database=pattern --dbname=pattern > For restore, we will make server connection with ‘pattern’ database and we will skip restoring for ‘pattern’ database as we are giving ‘pattern’ with --exclude-database. With server connection, we will restore global.dat at the start of pg_restore and for each database, we will fire the db creation command from 'pattern' db. Here, I am attaching an updated patch for review and testing. -- Thanks and Regards Mahendra Singh Thalor EnterpriseDB: http://www.enterprisedb.com