]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pg_restore: Remove unnecessary strlen() calls in options parsing.
authorNathan Bossart <nathan@postgresql.org>
Wed, 18 Mar 2026 19:22:15 +0000 (14:22 -0500)
committerNathan Bossart <nathan@postgresql.org>
Wed, 18 Mar 2026 19:22:15 +0000 (14:22 -0500)
commitec80215c033dfbea0e864b955ec9d2c0a7f4a4ca
treeb2293489d4b10139dd648f205a1be09b8beac4c0
parent1c5bf1185af0128a8415fc48155045fb16b51dee
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
src/bin/pg_dump/pg_restore.c
src/bin/pg_dump/t/001_basic.pl