pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Post Gresql <postgresql@taljaren.se>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: pg_restore error on function
Date: Thu, 3 Nov 2022 15:28:42 +0100
Message-ID: <32b7cafd-e649-5478-017d-766036a2afbd@taljaren.se> (raw)

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)?

The only workaround I can think of is to dump in plain text and then edit the dump file.





view thread (10+ messages)  latest in thread

Message-ID: <32b7cafd-e649-5478-017d-766036a2afbd@taljaren.se>
Permalink:  ../32b7cafd-e649-5478-017d-766036a2afbd@taljaren.se/
Also on:    postgresql.org/message-id/32b7cafd-e649-5478-017d-766036a2afbd@taljaren.se

 · 

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-general@postgresql.org
  Cc: postgresql@taljaren.se
  Subject: Re: pg_restore error on function
  In-Reply-To: <32b7cafd-e649-5478-017d-766036a2afbd@taljaren.se>
  References: <32b7cafd-e649-5478-017d-766036a2afbd@taljaren.se>

* 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