Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2DDF86500F9 for ; Wed, 27 Aug 2008 12:41:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 07001-01 for ; Wed, 27 Aug 2008 12:40:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx00.pub.collaborativefusion.com (mx00.pub.collaborativefusion.com [206.210.89.199]) by postgresql.org (Postfix) with ESMTP id 10E3A64FD12 for ; Wed, 27 Aug 2008 12:40:46 -0300 (ADT) Received: from vanquish.ws.pitbpa0.priv.collaborativefusion.com (vanquish.ws.pitbpa0.priv.collaborativefusion.com [192.168.2.162]) (SSL: TLSv1/SSLv3,256bits,AES256-SHA) by wingspan with esmtp; Wed, 27 Aug 2008 11:40:45 -0400 id 00056427.0000000048B5757D.000143B7 Date: Wed, 27 Aug 2008 11:41:08 -0400 From: Bill Moran To: "Phoenix Kiula" Cc: "PG-General Mailing List" Subject: Re: Dumping/Restoring with constraints? Message-Id: <20080827114108.cf0c9704.wmoran@collaborativefusion.com> In-Reply-To: References: <22708.1219845242@sss.pgh.pa.us> <23571.1219848176@sss.pgh.pa.us> <23743.1219848802@sss.pgh.pa.us> Organization: Collaborative Fusion X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.11; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/960 X-Sequence-Number: 136790 In response to "Phoenix Kiula" : > On Wed, Aug 27, 2008 at 10:53 PM, Tom Lane wrote: > > > > > No, you were right the first time: just feed the dump script to psql. > > > > Ok. Tried that. Because there's no database, I have to execute the > psql command as "postgres" otherwise it doesn't work. > > So here's my command: > > $ psql -d postgres -U postgres -h localhost < mydb.sql > > This seems to be it. This is what I should be executing, except that > it spews out many errors, like: > > ERROR: invalid byte sequence for encoding "UTF8": 0x80 In psql, do a \l on both the original and the DB you're restoring to. The encoding should be the same, if it's not, then fix that before restoring. If you're using pg_dump (which you don't mention ... it's getting difficult to follow what you're doing in this thread) then you can also use the -C option to have pg_dump add a CREATE DATABASE statement to the dump file for you. If you actually want to switch database encodings, that's an entirely different question thread unto itself. -- Bill Moran Collaborative Fusion Inc. http://people.collaborativefusion.com/~wmoran/ wmoran@collaborativefusion.com Phone: 412-422-3463x4023