pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brent Wood <pcreso@yahoo.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
To: Atul Kumar <akumar14871@gmail.com>
Subject: Re: Backup schema without data
Date: Fri, 7 Apr 2023 00:59:12 +0000 (UTC)
Message-ID: <694694106.675857.1680829152749@mail.yahoo.com> (raw)
In-Reply-To: <CA+ONtZ53ZxLJm5+pe0O4wSgLeX+xZQerRzVTrowHT=GgdsD7hw@mail.gmail.com>
References: <CA+ONtZ53ZxLJm5+pe0O4wSgLeX+xZQerRzVTrowHT=GgdsD7hw@mail.gmail.com>

 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@gmail.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
  

view thread (4+ messages)

Message-ID: <694694106.675857.1680829152749@mail.yahoo.com>
Permalink:  ../694694106.675857.1680829152749@mail.yahoo.com/
Also on:    postgresql.org/message-id/694694106.675857.1680829152749@mail.yahoo.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: pcreso@yahoo.com, akumar14871@gmail.com
  Subject: Re: Backup schema without data
  In-Reply-To: <694694106.675857.1680829152749@mail.yahoo.com>
  References: <CA+ONtZ53ZxLJm5+pe0O4wSgLeX+xZQerRzVTrowHT=GgdsD7hw@mail.gmail.com> <694694106.675857.1680829152749@mail.yahoo.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