Re: Errors when restoring backup created by pg_dumpall

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Errors when restoring backup created by pg_dumpall
Date: 2024-12-10 05:31:15
Message-ID: 49199b35-28a8-46e9-b874-8fce89fccfa6@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/9/24 20:54, Ron Johnson wrote:
> On Mon, Dec 9, 2024 at 11:24 PM David G. Johnston
> <david(dot)g(dot)johnston(at)gmail(dot)com <mailto:david(dot)g(dot)johnston(at)gmail(dot)com>> wrote:
>
> On Monday, December 9, 2024, Ron Johnson <ronljohnsonjr(at)gmail(dot)com
> <mailto:ronljohnsonjr(at)gmail(dot)com>> wrote:
>
> On Sat, Nov 30, 2024 at 10:36 PM Adrian Klaver
> <adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>>
> wrote:
> [snip]
>
> In future schema qualify all references.
>
> For now in the dump file you could search for
>
> SELECT pg_catalog.set_config('search_path', '', false);
>
> and set to
>
> SELECT pg_catalog.set_config('search_path', 'public', false);
>
>
> What if this had been a pg_dump --format={custom,directory} backup?
>
>
> pg_restore has a mode where it can dump out SQL to a script instead
> of directly restoring to the database.
>
>
> That Would Be Very, Very Bad if this were a database big enough to have
> required a multi-threaded dump.

From the original post:

https://www.postgresql.org/message-id/6a6439f1-8039-44e2-8fb9-59028f7f2014%40mailbox.org

"My HDD recently failed so I'm trying to restore my backup, but I'm
running into some errors."

There really was no choice.

Not tested but in the pg_restore case I could see at least trying:

1) pg_restore -s -f schema_definitions.sql custom_format_file

2) Then making the change in the search_path in schema_definitions.sql
and then load the schema in the database using psql

3) Then pg_restore -a -j <number_of_jobs> custom_format_file.

>
> --
> Death to <Redacted>, and butter sauce.
> Don't boil me, I'm still alive.
> <Redacted> lobster!

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Allan Kamau 2024-12-10 12:59:00 Formulating SQL queries via Retrieval Augmented Generation (RAG).
Previous Message Ron Johnson 2024-12-10 04:54:25 Re: Errors when restoring backup created by pg_dumpall