Postgresql – Postgres CREATE DATABASE already has data and tables

postgresql

When I do a: DROP DATABASE mydb; and subsequently: CREATE DATABASE mydb WITH OWNER user; the new mydb database is created with all the tables and data that I had in the database I just dropped. What am I be missing?

Best Answer

You probably created some tables (with data) in the database template1.

Connect to that database (e.g.: psql postgres template1) and drop everything you don't need there.

More details in the manual: http://www.postgresql.org/docs/current/static/manage-ag-templatedbs.html