databasepostgresqldrop-database

How do I remove database from postgresql native app on mac?


I am trying to remove a db in postgresql but its still viewable in the mac native app even after I have confirmed its been removed from the terminal. Should I be concerned?

Here is my terminal command and output

drop database if exists Javascript_Rails_Project_development;
NOTICE:  database "javascript_rails_project_development" does not exist, skipping
DROP DATABASE

database image


Solution

  • You possibly created the database putting its name in double quotes as "Javascript_Rails_Project_development". Note the upper case letters.

    Usually identifiers in SQL are case insensitive. If you quote them in such a way however, they become case sensitive. That is, there is no database named javascript_rails_project_development as the letters are all lower case.

    Once created with the name double quotes and including upper case characters you need to address the object afterwards by a name in double quotes with the exact matching cases of the letters.

    Try:

    DROP DATABASE IF EXISTS "Javascript_Rails_Project_development" ;
    

    And possibly avoid upper case and quoted names in the future all together. It's just making things more complicated in most of the cases.