Re: Dumping table definitions

From: Dawid Kuroczko <qnex42(at)gmail(dot)com>
To: Mark Fenbers <Mark(dot)Fenbers(at)noaa(dot)gov>
Cc: Pg SQL Discussion Group <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Dumping table definitions
Date: 2005-07-18 17:08:56
Message-ID: 758d5e7f0507181008403969ec@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 7/18/05, Mark Fenbers <Mark(dot)Fenbers(at)noaa(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andy 2005-07-19 07:55:41 Re: Create trigger for auto update function
Previous Message Tom Lane 2005-07-18 16:56:47 Re: Dumping table definitions