Re: Dumping table definitions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 16:56:47
Message-ID: 13034.1121705807@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Mark Fenbers" <Mark(dot)Fenbers(at)noaa(dot)gov> writes:
> 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 with the -s switch is a much better way ...

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dawid Kuroczko 2005-07-18 17:08:56 Re: Dumping table definitions
Previous Message Jim Buttafuoco 2005-07-18 16:56:35 Re: Dumping table definitions