Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id D54989FBB51 for ; Mon, 14 May 2007 19:56:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 03167-09 for ; Mon, 14 May 2007 19:56:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from rrmailscan3.safenetbox.biz (unknown [203.25.40.75]) by postgresql.org (Postfix) with ESMTP id 5290A9FBB9E for ; Mon, 14 May 2007 19:56:30 -0300 (ADT) Received: from rrmailscan3.safenetbox.biz (rrmailscan3.safenetbox.biz [127.0.0.1]) by rrmailscan3.safenetbox.biz (Postfix) with ESMTP id 7FE5E1D484A4 for ; Tue, 15 May 2007 08:56:28 +1000 (EST) Received: from [127.0.0.1] (online4-new.lnk.telstra.net [139.130.169.227]) (Authenticated sender: remote) by rrmailscan3.safenetbox.biz (Postfix) with ESMTP id B96CB1D48491 for ; Tue, 15 May 2007 08:56:26 +1000 (EST) Message-ID: <4648E913.9010908@autoledgers.com.au> Date: Tue, 15 May 2007 06:56:19 +0800 From: Paul Lambert User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: pg_dump? References: <887138.91241.qm@web50308.mail.re2.yahoo.com> In-Reply-To: <887138.91241.qm@web50308.mail.re2.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/112 X-Sequence-Number: 28392 Richard Dunne wrote: > PostgreSQL begginer. Whats the best way of exporting(dumping) a database/table/view/query to a file? > I am using PostgreSQL v 8.2. I am starting postgres server with > C:\WINDOWS\system32\net.exe start pgsql-8.2, (start service) > C:\postgresql-8.2.3-1\bin\psql.exe -h localhost -p 5432 postgres "Richard" > (psql to 'postgres') > both of which are run from shortcuts in the start menu. > my cli starts with "postgres #", then "databasename #" after connecting using \c. > > Richard. > > With exactly what you said in the subject... pg_dump http://www.postgresql.org/docs/8.2/static/app-pgdump.html Your other option would be with an SQL 'COPY' http://www.postgresql.org/docs/8.2/static/sql-copy.html The difference between the two is dump will give you output including the SQL used to put it back into the database, i.e. INSERT INTO statements whereas copy will give you a flat delimited file. -- Paul Lambert Database Administrator AutoLedgers