what's the escape sequence for hyphen (-) in PostgreSQL

Solution 1:

Double quotes should do it. But you'll have to always use the quoted-identifier everywhere you reference the database.

ALTER DATABASE one RENAME TO "one-two";

Solution 2:

Mix double quotes and single quotes as such:

psql --command='create database "db-name-with-dashes"'