DEV Community

eddiejpot
eddiejpot

Posted on

PostgreSQL: Drop a database that has a hyphen in the name

Normally to drop a database in psql (postgresql) , we can just type

DROP DATABASE dbname;
Enter fullscreen mode Exit fullscreen mode

If we want to drop a database called "db-name". we have to escape the database name which contains the hyphen by using double quotation marks.

DROP DATABASE "db-name";
Enter fullscreen mode Exit fullscreen mode

Resource link here here

Top comments (0)