pgsql: Tighten pg_restore's recognition of its -F (format) option value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Tighten pg_restore's recognition of its -F (format) option value
Date: 2025-01-25 16:24:20
Message-ID: E1tbixI-003TVl-9I@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Tighten pg_restore's recognition of its -F (format) option values.

Instead of checking just the first letter, match the whole string
using pg_strcasecmp. Per the documentation, we allow either just
the first letter (e.g. "c") or the whole name ("custom"); but we
will no longer accept random variations such as "chump". This
matches pg_dump's longstanding parsing code for the same option.

Also for consistency with pg_dump, recognize "p"/"plain". We don't
support it, but we can give a more helpful error message than
"unrecognized archive format".

Author: Srinath Reddy <srinath2133(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAFC+b6pfK-BGcWW1kQmtxVrCh-JGjB2X02rLPQs_ZFaDGjZDsQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/04ace176e08f2c694bb66b5b91cbd9d4d0bd77ea

Modified Files
--------------
src/bin/pg_dump/pg_restore.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2025-01-25 16:43:59 pgsql: Change shutdown sequence to terminate checkpointer last
Previous Message Jeff Davis 2025-01-25 08:12:36 pgsql: Fix PDF doc build.