pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_restore: Remove unnecessary strlen() calls in options parsing
Date: Wed, 18 Mar 2026 19:23:04 +0000
Message-ID: <E1w2wTv-000NeP-26@gemulon.postgresql.org> (raw)

pg_restore: Remove unnecessary strlen() calls in options parsing.

Unlike pg_dump and pg_dumpall, pg_restore first checks whether the
argument passed to --format, --host, and --port is empty before
setting the corresponding variable.  Consequently, pg_restore does
not error if given an empty format name, whereas pg_dump and
pg_dumpall do.  Empty arguments for --host and --port are ignored
by all three applications, so this commit produces no functionality
changes there.  This behavior should perhaps be reconsidered, but
that is left as a future exercise.  As with other recent changes to
option handling for these applications (commits b2898baaf7,
7c8280eeb5, and be0d0b457c), no back-patch.

Author: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Discussion: https://postgr.es/m/CAKYtNApkh%3DVy2DpNRCnEJmPpxNuksbAh_QBav%3D2fLmVjBhGwFw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ec80215c033dfbea0e864b955ec9d2c0a7f4a4ca

Modified Files
--------------
src/bin/pg_dump/pg_restore.c   | 9 +++------
src/bin/pg_dump/t/001_basic.pl | 7 ++++++-
2 files changed, 9 insertions(+), 7 deletions(-)



Message-ID: <E1w2wTv-000NeP-26@gemulon.postgresql.org>
Permalink:  ../E1w2wTv-000NeP-26@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w2wTv-000NeP-26@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_restore: Remove unnecessary strlen() calls in options parsing
  In-Reply-To: <E1w2wTv-000NeP-26@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox