pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedSchema dump
6+ messages / 3 participants
[nested] [flat]
* Schema dump
@ 2020-01-02 07:15 Sonam Sharma <sonams1209@gmail.com>
2020-01-02 13:47 ` Re: Schema dump Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Sonam Sharma @ 2020-01-02 07:15 UTC (permalink / raw)
To: pgsql-general
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Schema dump
2020-01-02 07:15 Schema dump Sonam Sharma <sonams1209@gmail.com>
@ 2020-01-02 13:47 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-01-02 15:59 ` Re: Schema dump Adrian Klaver <adrian.klaver@aklaver.com>
2020-01-02 16:20 ` Re: Schema dump Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 6+ messages in thread
From: Tom Lane @ 2020-01-02 13:47 UTC (permalink / raw)
To: Sonam Sharma <sonams1209@gmail.com>; +Cc: pgsql-general
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.)
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Schema dump
2020-01-02 07:15 Schema dump Sonam Sharma <sonams1209@gmail.com>
2020-01-02 13:47 ` Re: Schema dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-01-02 15:59 ` Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2020-01-02 15:59 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Sonam Sharma <sonams1209@gmail.com>; +Cc: pgsql-general
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.)
What version? As I see:
pg_dump -U postgres -d production -n utility -f utility_sch.sql
In utility_sch.sql:
CREATE SCHEMA utility;
I ask because the docs:
https://www.postgresql.org/docs/12/app-pgdump.html
"Dump only schemas matching pattern; this selects both the schema
itself, and all its contained objects. "
support the idea that the schema definition is dumped.
>
> regards, tom lane
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Schema dump
2020-01-02 07:15 Schema dump Sonam Sharma <sonams1209@gmail.com>
2020-01-02 13:47 ` Re: Schema dump Tom Lane <tgl@sss.pgh.pa.us>
@ 2020-01-02 16:20 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-01-02 17:04 ` Re: Schema dump Sonam Sharma <sonams1209@gmail.com>
1 sibling, 1 reply; 6+ messages in thread
From: Adrian Klaver @ 2020-01-02 16:20 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Sonam Sharma <sonams1209@gmail.com>; +Cc: pgsql-general
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Schema dump
2020-01-02 07:15 Schema dump Sonam Sharma <sonams1209@gmail.com>
2020-01-02 13:47 ` Re: Schema dump Tom Lane <tgl@sss.pgh.pa.us>
2020-01-02 16:20 ` Re: Schema dump Adrian Klaver <adrian.klaver@aklaver.com>
@ 2020-01-02 17:04 ` Sonam Sharma <sonams1209@gmail.com>
2020-01-02 17:10 ` Re: Schema dump Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 6+ messages in thread
From: Sonam Sharma @ 2020-01-02 17:04 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-general
Thanks Adrian, it worked :)
On Thu, Jan 2, 2020, 9:50 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:
> 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
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Schema dump
2020-01-02 07:15 Schema dump Sonam Sharma <sonams1209@gmail.com>
2020-01-02 13:47 ` Re: Schema dump Tom Lane <tgl@sss.pgh.pa.us>
2020-01-02 16:20 ` Re: Schema dump Adrian Klaver <adrian.klaver@aklaver.com>
2020-01-02 17:04 ` Re: Schema dump Sonam Sharma <sonams1209@gmail.com>
@ 2020-01-02 17:10 ` Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 6+ messages in thread
From: Adrian Klaver @ 2020-01-02 17:10 UTC (permalink / raw)
To: Sonam Sharma <sonams1209@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; 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.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
> On 1/2/20 5:47 AM, Tom Lane wrote:
> > Sonam Sharma <sonams1209@gmail.com <mailto: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 <mailto:adrian.klaver@aklaver.com>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2020-01-02 17:10 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02 07:15 Schema dump Sonam Sharma <sonams1209@gmail.com>
2020-01-02 13:47 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-01-02 15:59 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-01-02 16:20 ` Adrian Klaver <adrian.klaver@aklaver.com>
2020-01-02 17:04 ` Sonam Sharma <sonams1209@gmail.com>
2020-01-02 17:10 ` Adrian Klaver <adrian.klaver@aklaver.com>
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