Re: Mind of its own?

From: <s400t(at)yahoo(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Mind of its own?
Date: 2019-03-01 15:15:37
Message-ID: 871505622.1579923.1551453337845.JavaMail.yahoo@mail.yahoo.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

JD, IB, TL:

Yes!!! I found the whole bunch of tables in template 1!

It's so liberating. 

Thank you.

----- Original Message -----
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: s400t(at)yahoo(dot)co(dot)jp
> Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
> Date: 2019/2/28, Thu 17:24
> Subject: Re: Mind of its own?
>
>& lt;s400t(at)yahoo(dot)co(dot)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 already inside 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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Philippe Chenel 2019-03-01 15:59:28 RE: PostgreSQL (linux) configuration with GSSAPI to a Windows domain
Previous Message Nicola Contu 2019-03-01 15:01:03 Performance comparison between Pgsql 10.5 and Pgsql 11.2