| From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> | 
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Sonam Sharma <sonams1209(at)gmail(dot)com> | 
| Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: Schema dump | 
| Date: | 2020-01-02 15:59:01 | 
| Message-ID: | 2c45d799-f4c1-0f59-f41b-32108da73682@aklaver.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On 1/2/20 5:47 AM, Tom Lane wrote:
> Sonam Sharma <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.)
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(dot)klaver(at)aklaver(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Adrian Klaver | 2020-01-02 16:20:19 | Re: Schema dump | 
| Previous Message | Tom Lane | 2020-01-02 13:47:34 | Re: Schema dump |