Re: pg_restore error on function

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_restore error on function
Date: 2022-11-03 14:45:26
Message-ID: 6a033389-4f9e-6427-b9e5-e5284a8cfabf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/3/22 09:28, Post Gresql wrote:
> Hello
>
> I first successfully ran
>
> pg_dump -U postgres -b -E UTF8 -f my_dump --format=custom -n my_schema
> --no-owner -v my_db
>
> but then
>
> pg_restore --single-transaction -v -U postgres -O -e -d my_other_db my_dump
>
> failed with
>
> pg_restore: connecting to database for restore
> pg_restore: creating FUNCTION "my_schema.update_b()"
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 7142; 1255 8618854
> FUNCTION update_b() previous_owner
> pg_restore: [archiver (db)] could not execute query: ERROR: schema
> my_schema" does not exist
>     Command was: CREATE FUNCTION "my_schema".update_b() RETURNS void
>     LANGUAGE plpgsql
>     AS $$
>             BEGIN
>             PERFORM pg_advisory_xact_lock(1);
>
>             INSERT INTO ...;
>             END;
>             $$;
>
>
> This is PG version 10.19
>
> Is there a solution for this (apart from upgrading to a newer PG version)?

What was the *complete* pg_dump command?

--
Angular momentum makes the world go 'round.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2022-11-03 14:57:20 Re: pg_restore error on function
Previous Message Adrian Klaver 2022-11-03 14:43:17 Re: pg_restore error on function