Reputation: 956
I have created some databases with postgres, and put some data in them.
The problem is when I delete/drop database, and then create new database, the new database always contains tables and data from the first database that was created with postgres.
How can I delete database so that, when the new database is created it dosent contain data from old database?
Thanks
Upvotes: 4
Views: 3224
Reputation: 3
Delete the rows in table using truncate commnad
truncate <tablename>
then delete database using drop command
drop database <databasename>
Upvotes: 0
Reputation:
It sounds like you created tables in the template1 database (or you specify the TEMPLATE xyz
option with your CREATE DATABASE
statement).
To get rid of the tables in the template1 database, connect to it and drop all tables there. After that new database will not contain those tables any more.
Upvotes: 5