pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Sonam Sharma <sonams1209@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Schema dump
Date: Thu, 2 Jan 2020 08:20:19 -0800
Message-ID: <d70458b1-8059-f5c0-cbf6-9410e00a1e23@aklaver.com> (raw)
In-Reply-To: <11647.1577972854@sss.pgh.pa.us>
References: <CAM-M3Tmj=caRsGiyD9_uE_9Ks+GZzjoFQii5twC-H650_GkXFA@mail.gmail.com>
	<11647.1577972854@sss.pgh.pa.us>

On 1/2/20 5:47 AM, Tom Lane wrote:
> Sonam Sharma <sonams1209@gmail.com> writes:
>> I took a schema dump using : pg_dump -n schema dbname .
>> When I restored this , it doesn't contain the constraints and indexes. Can
>> someone please help how to take a dump including all
> 
> Hmph ... works for me.  Where by "works", I mean "the dump contains
> constraints and indexes belonging to tables in the specified schema,
> and not any others".  Maybe you could provide a little more detail?
> 
> (One thing I notice is that the dump doesn't contain a "CREATE
> SCHEMA schema" command, so you have to do that manually before
> you restore.  I guess this fits with the definition of the switch
> as selecting objects *in* the named schema, but it's still a
> possible gotcha.)

Caffeine kicked in, now I remember how the above happens:

pg_restore -n utility -f pgrestore_utility.sql /production_12.out

In pgrestore_utility.sql there is no CREATE SCHEMA.

This came up in a previous thread:

https://www.postgresql.org/message-id/6234.1569941612%40sss.pgh.pa.us

> 
> 			regards, tom lane
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (6+ messages)  latest in thread

Message-ID: <d70458b1-8059-f5c0-cbf6-9410e00a1e23@aklaver.com>
Permalink:  ../d70458b1-8059-f5c0-cbf6-9410e00a1e23@aklaver.com/
Also on:    postgresql.org/message-id/d70458b1-8059-f5c0-cbf6-9410e00a1e23@aklaver.com

 · 

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: adrian.klaver@aklaver.com, tgl@sss.pgh.pa.us, sonams1209@gmail.com
  Subject: Re: Schema dump
  In-Reply-To: <d70458b1-8059-f5c0-cbf6-9410e00a1e23@aklaver.com>
  References: <CAM-M3Tmj=caRsGiyD9_uE_9Ks+GZzjoFQii5twC-H650_GkXFA@mail.gmail.com> <11647.1577972854@sss.pgh.pa.us> <d70458b1-8059-f5c0-cbf6-9410e00a1e23@aklaver.com>

* 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