Re: Schema dump

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Sonam Sharma <sonams1209(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Schema dump
Date: 2020-01-02 17:10:12
Message-ID: 2e730b45-01a8-7bf6-0365-a64921055662@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/2/20 9:04 AM, Sonam Sharma wrote:
> Thanks Adrian, it worked :)

What worked?

Still not clear what was not working in the first place?

>
> On Thu, Jan 2, 2020, 9:50 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
> <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
>
> On 1/2/20 5:47 AM, Tom Lane wrote:
> > Sonam Sharma <sonams1209(at)gmail(dot)com <mailto:sonams1209(at)gmail(dot)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(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message İlyas Derse 2020-01-03 09:53:50 How can I set a timeout for a locked table in Function ?
Previous Message Sonam Sharma 2020-01-02 17:04:18 Re: Schema dump