X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 02F3B52AE8 for ; Mon, 18 Jul 2005 13:57:06 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00654-09 for ; Mon, 18 Jul 2005 16:57:04 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6A48352AD5 for ; Mon, 18 Jul 2005 13:57:04 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j6IGulPE013035; Mon, 18 Jul 2005 12:56:47 -0400 (EDT) To: "Mark Fenbers" Cc: Pg SQL Discussion Group Subject: Re: Dumping table definitions In-reply-to: <42DBDDEE.3090903@noaa.gov> References: <42DBDDEE.3090903@noaa.gov> Comments: In-reply-to "Mark Fenbers" message dated "Mon, 18 Jul 2005 12:50:54 -0400" Date: Mon, 18 Jul 2005 12:56:47 -0400 Message-ID: <13034.1121705807@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/154 X-Sequence-Number: 22132 "Mark Fenbers" 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