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 9CA1552AC2 for ; Mon, 18 Jul 2005 13:51:01 -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 98974-09 for ; Mon, 18 Jul 2005 16:50:58 +0000 (GMT) Received: from werhmsg.werh.noaa.gov (werhmsg.werh.noaa.gov [198.206.32.236]) by svr1.postgresql.org (Postfix) with ESMTP id C5B6752AA6 for ; Mon, 18 Jul 2005 13:50:56 -0300 (ADT) Received: from [198.206.42.50] ([198.206.42.50]) by werhmsg.werh.noaa.gov (Netscape Messaging Server 4.15) with ESMTP id IJU1GZ00.B3U for ; Mon, 18 Jul 2005 12:50:59 -0400 Message-ID: <42DBDDEE.3090903@noaa.gov> Date: Mon, 18 Jul 2005 12:50:54 -0400 From: "Mark Fenbers" Organization: DoC/NOAA/NWS/OHRFC User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Pg SQL Discussion Group Subject: Dumping table definitions Content-Type: multipart/mixed; boundary="------------040503060204070609080604" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.051 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/153 X-Sequence-Number: 22131 This is a multi-part message in MIME format. --------------040503060204070609080604 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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? Also, Is there a way to export the structure of all tables at once instead of one table at a time? Mark --------------040503060204070609080604 Content-Type: text/x-vcard; charset=utf-8; name="Mark.Fenbers.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Mark.Fenbers.vcf" begin:vcard fn:Mark Fenbers n:Fenbers;Mark org:DoC/NOAA/NWS/OHRFC adr:;;1901 South SR 134;Wilmington;OH;45177-9708;USA email;internet:Mark.Fenbers@noaa.gov title:Sr. HAS Meteorologist tel;work:937-383-0430 x246 x-mozilla-html:TRUE url:http://weather.gov/ohrfc version:2.1 end:vcard --------------040503060204070609080604--