Re: Dumping/Restoring with constraints?

From: Bill Moran <wmoran(at)collaborativefusion(dot)com>
To: "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>
Cc: "PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Dumping/Restoring with constraints?
Date: 2008-08-27 15:41:08
Message-ID: 20080827114108.cf0c9704.wmoran@collaborativefusion.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

In response to "Phoenix Kiula" <phoenix(dot)kiula(at)gmail(dot)com>:

> On Wed, Aug 27, 2008 at 10:53 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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(at)collaborativefusion(dot)com
Phone: 412-422-3463x4023

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Andrew Sullivan 2008-08-27 15:41:10 Re: Dumping/Restoring with constraints?
Previous Message Andrew Sullivan 2008-08-27 15:32:38 Re: Dumping/Restoring with constraints?

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2008-08-27 15:41:10 Re: Dumping/Restoring with constraints?
Previous Message Andrew Sullivan 2008-08-27 15:32:38 Re: Dumping/Restoring with constraints?