pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Dino Mifsud <dinomifsud74@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: restore OIDs
Date: Fri, 16 Mar 2018 10:40:52 +0100
Message-ID: <1521193252.2501.2.camel@cybertec.at> (raw)
In-Reply-To: <CAEkXPXk8hE3GAnhxEO4nD3RX+2MnhLmS1=jgVPhikEq6i4Uy_w@mail.gmail.com>
References: <CAEkXPXk8hE3GAnhxEO4nD3RX+2MnhLmS1=jgVPhikEq6i4Uy_w@mail.gmail.com>

Dino Mifsud wrote:
> I have a table where I am  storing images in a column of type OID which is
> pointing to the pg_largeobject table. 
> 
> Now when I try do a pg_dump and restore just a schema from one database to another
> with the below commands, the OID column in the table is correctly restored with the
> original number  but the pg_largeobject table in the restored database does not contain
> these OID entries that store the actual image bytes and therefore the images are not restored.
>
> pg_dump --data-only --host localhost --port 5432 --username "postgres" --schema=myschema \
>         --format custom --verbose --file "/Users/myuser/Work/databases_backup/original.backup" "db1"
>
> pg_restore --host localhostd --port 5432 --username "postgres" --schema=myshcema \
>            --disable-triggers -d db2 "/Users/myuser/Work/databases_backup/original.backup"
> 
> 
> How can I dump and restore correctly just a particular schema?

If you use the --schema option, but want to dump large objects too, add the --blobs option.

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com




view thread (3+ messages)

Message-ID: <1521193252.2501.2.camel@cybertec.at>
Permalink:  ../1521193252.2501.2.camel@cybertec.at/
Also on:    postgresql.org/message-id/1521193252.2501.2.camel@cybertec.at

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: laurenz.albe@cybertec.at, dinomifsud74@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: restore OIDs
  In-Reply-To: <1521193252.2501.2.camel@cybertec.at>

* 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