Re: pg_restore: remove unnecessary code from restore_all_databases function

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore: remove unnecessary code from restore_all_databases function
Date: 2026-03-15 16:16:11
Message-ID: 599d493e-01f7-4f74-bcc7-242b1dd1e025@dunslane.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2026-03-14 Sa 11:48 PM, Mahendra Singh Thalor wrote:
> Hi hackers,
>
> +++ b/src/bin/pg_dump/pg_restore.c
> @@ -1268,16 +1268,6 @@ restore_all_databases(const char *inputFileSpec,
>                  */
>                 memcpy(tmpopts, original_opts, sizeof(RestoreOptions));
>
> -               /*
> -                * We need to reset override_dbname so that objects
> can be restored
> -                * into an already created database. (used with
> -d/--dbname option)
> -                */
> -               if (tmpopts->cparams.override_dbname)
> -               {
> - pfree(tmpopts->cparams.override_dbname);
> -                       tmpopts->cparams.override_dbname = NULL;
> -               }
> -
>
> In commit 77152d26efefde2eed4, we added some functions and we missed
> to remove some unnecessary lines. Those lines are not needed as we are
> using memcpy to get the original copy before these lines.
>
> Here, I am attaching a patch to fix this. Please review it.

Thanks. Pushed.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-03-15 16:20:41 Re: bug: pg_dumpall with --data-only and --clean options is giving an error after some dump
Previous Message Pavel Stehule 2026-03-15 15:20:42 Re: WIP - xmlvalidate implementation from TODO list