I want to create database called "President" by rightclicking on PostgreSQL and selecting Create Database .
However, I get the error in the screenprint below.
I can create databases with other names like SomeOtherDatabase and SomeOtherDatabase2 (see screenprints).
Any ideas how I can find and delete the database "President" that seems to exist already?
UPDATE!!
If I execute
select * from pg_database
I get the following result:
So database "President" does seem to exist. (Meanwhile I deleted someOtherDatabase and someOtherDatabase2 .)
However, if I execute
drop database President
I get:
You can query catalog view pg_database
to check if the database already exists:
select datname from pg_database WHERE datname = 'president'
And drop it with drop database
:
drop database president;
Note that Postgres' drop database
syntax supports the if exists
clause, which may come handy in your use case:
drop database if exists president;
You can right click on the postgres
database and select edit connection
option. Under the PostgreSQL tab, check the Show all databases
option.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.