Re: Recommended approach for upgrading DBs with nonmatching encodings

Поиск
Список
Период
Сортировка
От Martin Pitt
Тема Re: Recommended approach for upgrading DBs with nonmatching encodings
Дата
Msg-id 20080330205847.GP6486@piware.de
обсуждение исходный текст
Ответ на Re: Recommended approach for upgrading DBs with nonmatching encodings  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Recommended approach for upgrading DBs with nonmatching encodings  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Tom Lane [2008-03-30 16:43 -0400]:
> Martin Pitt <martin@piware.de> writes:
> > One problem with this is that while pg_dump -E UTF8 works (with SQL
> > output), -E does not seem to have any effect when using -Fc.
>
> Huh?  Please provide a test case.

Ah, I got it. This fails:

  pg_dump -Fc -E UTF8 -p 5432  latin1test | pg_restore -p 5433 -d template1 -C

(5432 is 8.1, 5433 is 8.3, both with locale ru_RU.UTF-8;
createdb -E latin1 latin1test)

But if I create the DB beforehand (with correct encoding) and then
dump/restore without using -C, it works fine:

  createdb -p 5433 latin1test
  pg_dump -Fc -p 5432  latin1test | pg_restore -p 5433 -d latin1test

In that case I do not even need to specify -E. Seems that
pg_dump/pg_restore are clever enough to detect encodings and necessary
conversions.

So this seems to be the cleanest approach to me, and it's free of
hacks. pg_restore restores the correct owner of the DB, so calling
createdb as the DB superuser does not harm.

Thanks,

Martin
--
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Recommended approach for upgrading DBs with nonmatching encodings
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Recommended approach for upgrading DBs with nonmatching encodings