snippetsqlMinor
Postgres CREATE DATABASE already has data and tables
Viewed 0 times
tablescreatepostgresdatabasehasalreadyanddata
Problem
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?Solution
You probably created some tables (with data) in the database
Connect to that database (e.g.:
More details in the manual: http://www.postgresql.org/docs/current/static/manage-ag-templatedbs.html
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
Context
StackExchange Database Administrators Q#56940, answer score: 5
Revisions (0)
No revisions yet.