Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error
Date: 2026-03-16 19:34:34
Message-ID: abhbSpewJZz0H999@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 15, 2026 at 10:32:11PM +0530, Mahendra Singh Thalor wrote:
> Here, I am attaching an updated patch for the review. I removed the
> length check for host, port and format in pg_restore as we don't have
> check in pg_dump also.

Looks generally reasonable to me.

> I think we don't need any test cases for host and port.

Why not?

> If we want to backpatch, then I can make patches for back branches but
> as of now, I am uploading a patch for master only.

-1 for back-patching. --format seems to have been broken since pg_restore
was first committed in 2000 (commit 500b62b057), so I don't sense any
urgency here. Not to mention that someone might be relying on the current
behavior.

> +command_fails_like(
> + [ 'pg_restore', '-f -', '-F', 'p' ],
> + qr/\Qpg_restore: error: archive format "p" is not supported; please use psql\E/,
> + 'pg_restore: unrecognized archive format p|plain');

How does this test relate to this change?

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-03-16 19:45:07 Re: Improve OAuth discovery logging
Previous Message Alvaro Herrera 2026-03-16 19:34:12 Re: Adding REPACK [concurrently]