pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dawid Kuroczko <qnex42@gmail.com>
To: Mark Fenbers <Mark.Fenbers@noaa.gov>
Cc: Pg SQL Discussion Group <pgsql-sql@postgresql.org>
Subject: Re: Dumping table definitions
Date: Mon, 18 Jul 2005 19:08:56 +0200
Message-ID: <758d5e7f0507181008403969ec@mail.gmail.com> (raw)
In-Reply-To: <42DBDDEE.3090903@noaa.gov>
References: <42DBDDEE.3090903@noaa.gov>

On 7/18/05, Mark Fenbers <Mark.Fenbers@noaa.gov> wrote:
> I am looking for a way to reformat the information that is generated from
>     \d mytable
> into SQL syntax, such that the table can be recreated with 'psql -f
> mytable.sql' complete with index and constraint definitions.  I can do
> awk and sed commands to do this if I need to, but first wanted to check
> if Pg already had tools to export the table structure (without the
> data).  Does it?

pg_dump is your friend!  Use option -s (--schema-only).
It will dump the information you want. :-)

  Regards,
    Dawid



view thread (4+ messages)

Message-ID: <758d5e7f0507181008403969ec@mail.gmail.com>
Permalink:  ../758d5e7f0507181008403969ec@mail.gmail.com/
Also on:    postgresql.org/message-id/758d5e7f0507181008403969ec@mail.gmail.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: qnex42@gmail.com, Mark.Fenbers@noaa.gov
  Subject: Re: Dumping table definitions
  In-Reply-To: <758d5e7f0507181008403969ec@mail.gmail.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