Re: Create database bug in 8.1.3 ? -> solved

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Create database bug in 8.1.3 ? -> solved
Дата
Msg-id
9044.1144598168@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Re: Create database bug in 8.1.3 ? "William ZHANG" <uniware@zedware.org>
Re: Create database bug in 8.1.3 ? -> solved "Milen Kulev" <makulev@gmx.net>
Re: Create database bug in 8.1.3 ? -> solved Douglas McNaught <doug@mcnaught.org>
Re: Create database bug in 8.1.3 ? -> solved "Milen Kulev" <makulev@gmx.net>
Re: Create database bug in 8.1.3 ? -> solved Tom Lane <tgl@sss.pgh.pa.us>
"Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) "Milen Kulev" <makulev@gmx.net>
Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) Tom Lane <tgl@sss.pgh.pa.us>
Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) "Milen Kulev" <makulev@gmx.net>
Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) Tom Lane <tgl@sss.pgh.pa.us>
Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) "Milen Kulev" <makulev@gmx.net>
Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) Tom Lane <tgl@sss.pgh.pa.us>
Re: "Pg_restore -C" is not creating a database ( Was Create database bug in 8.1.3 ? ) "Milen Kulev" <makulev@gmx.net>
Douglas McNaught  writes:
> "Milen Kulev"  writes:
>> I can not understand why pg_dump, pg_dumpall have hard-coded "template0" ?

> The reason is this:  any extra stuff that your database inherited from
> template1 (or whatever template you used) will be dumped out as part
> of your database.  There is no way to for pg_dump to tell what parts
> came from template1 and what parts were added afterward, so it bases
> its dump on template0, which is a minimal database.  If you based your
> restored database on template1, you would get collisions as the
> restore tried to add objects that were already there from template1.

Not only that.  If you changed template1 after creating your database
from it, then a dump and restore of your database would be wrong if it
used template1: it would produce a database that did not match what was
dumped, but rather included those subsequent changes in template1.
(Which might in fact be what you'd wish for, but it's not pg_dump's
charter.)  template0 is not only minimal but stable, so basing the
restore relative to it is more likely to produce a matching database
than using template1.

			regards, tom lane
В списке pgsql-general по дате отправления
От: Merlin Moncure
Дата:
Сообщение: Re: how to document database
От: Simon Riggs
Дата:
FAQ