Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewlrE-00029K-HS for pgsql-admin@arkaria.postgresql.org; Fri, 16 Mar 2018 09:41:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ewlrB-0001d8-5u for pgsql-admin@arkaria.postgresql.org; Fri, 16 Mar 2018 09:41:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewlrA-0001cy-UY for pgsql-admin@lists.postgresql.org; Fri, 16 Mar 2018 09:41:00 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ewlr7-0004wK-Cy for pgsql-admin@lists.postgresql.org; Fri, 16 Mar 2018 09:41:00 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 9C2D942A53; Fri, 16 Mar 2018 10:40:54 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id pMLBfszAKN3B; Fri, 16 Mar 2018 10:40:54 +0100 (CET) Message-ID: <1521193252.2501.2.camel@cybertec.at> Subject: Re: restore OIDs From: Laurenz Albe To: Dino Mifsud , pgsql-admin@lists.postgresql.org Date: Fri, 16 Mar 2018 10:40:52 +0100 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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