pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: imchifan@mail.com
Subject: BUG #19891: pg_restore ignores an explicitly empty -F argument
Date: Wed, 11 Nov 2026 16:24:27 +0000
Message-ID: <19891-0b151c9cd5969ede@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      19891
Logged by:          Faye
Email address:      imchifan@mail.com
PostgreSQL version: 18.6
Operating system:   Linux/amd64
Description:        

pg_restore treats an explicitly empty -F/--format argument as though the
option were absent and proceeds with archive-format auto-detection. With
empty input, I get an input-file error, while another invalid format is
rejected during option validation.

Because -F requires an archive format and accepts only c, d, or t, an
explicitly supplied empty value should be rejected as an unrecognized
archive format rather than enabling auto-detection.

How to repeat:

Run these commands with pg_restore on PATH:

```
pg_restore -f - -F '' </dev/null
pg_restore -f - -F garbage </dev/null
```

PostgreSQL 18.6 produces:

```
pg_restore: error: input file is too short (read 0, expected 5)
pg_restore: error: unrecognized archive format "garbage"; please specify
"c", "d", or "t"
```

The empty value should instead be rejected consistently with the other
invalid value, identifying the empty string as an unrecognized archive
format.

The issue was reproduced with pg_restore from PostgreSQL 18.6 (Debian
18.6-1.pgdg13+2) on Linux/amd64. The option handler records the format name
only when the argument is nonempty, so an explicitly empty argument remains
indistinguishable from an omitted -F option. This occurs when pg_restore is
invoked with an explicitly empty archive-format argument.








Message-ID: <19891-0b151c9cd5969ede@postgresql.org>
Permalink:  ../19891-0b151c9cd5969ede@postgresql.org/
Also on:    postgresql.org/message-id/19891-0b151c9cd5969ede@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, imchifan@mail.com
  Subject: Re: BUG #19891: pg_restore ignores an explicitly empty -F argument
  In-Reply-To: <19891-0b151c9cd5969ede@postgresql.org>
  References: <19891-0b151c9cd5969ede@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