Re: Mind of its own?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Mind of its own?
Дата
Msg-id 4099.1551399886@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Mind of its own?  (<s400t@yahoo.co.jp>)
Ответы Re: Mind of its own?
Список pgsql-general
<s400t@yahoo.co.jp> writes:
> I am using Postgresql 9.6, and the latest phppgadmin. OS is Debian 9.6.

> 1. Created a database.
> 2. Created tables inside that database.
> 3. Dropped that database.

> Now, what happens is when I create another database with the same name or different name, all those tables are
alreadyinside that database!!! I have not run the table create script.  

I think you created some tables in the "template1" database, which is
(by default) what CREATE DATABASE clones to make a new DB.  Duplicating
its contents is considered a feature not a bug.

You could manually clean out template1, or if that seems painful,
you could drop it and recreate it by cloning template0 (see
CREATE DATABASE's TEMPLATE option).  template0 exists precisely
to be a virgin empty database for this sort of purpose.

(There is an interlock to prevent you from dropping either
of these template databases accidentally.  Overriding that is
left as an exercise for the student.)

            regards, tom lane


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

Предыдущее
От: "Ahmed, Nawaz"
Дата:
Сообщение: RE: Barman disaster recovery solution
Следующее
От: Andre Piwoni
Дата:
Сообщение: Re: PostgreSQL (linux) configuration with GSSAPI to a Windows domain