Re: Backup schema without data

From: Brent Wood <pcreso(at)yahoo(dot)com>
To: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>, Atul Kumar <akumar14871(at)gmail(dot)com>
Subject: Re: Backup schema without data
Date: 2023-04-07 00:59:12
Message-ID: 694694106.675857.1680829152749@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Looking at the result of:

pg_dump --help
Usage:
  pg_dump [OPTION]... [DBNAME]
...  -n, --schema=PATTERN         dump the specified schema(s) only...
 -s, --schema-only            dump only the schema, no data... 

So: pg_dump -s -n <schema> <db>

It works for me...

Cheers
Brent Wood

On Friday, April 7, 2023 at 12:40:58 PM GMT+12, Atul Kumar <akumar14871(at)gmail(dot)com> wrote:

Hi,
Please help me in telling that how I can take the backup of one single schema without its data using pg_dump utility ?

So far, I could not find anything suitable for doing so.
Regards,Atul

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Louis Tian 2023-04-07 01:27:59 Re: [EXTERNAL]: Re: UPSERT in Postgres
Previous Message Tom Lane 2023-04-07 00:54:11 Re: Backup schema without data