I have tried to create a postgresql database from linux(CentOS) command line by executing the following,

psql -U admin -p55432 postgres -c "CREATE DATABASE TEST_DB"

Created database name appeared as "test_db". I need to create database in upper case.

2 Answers 2


In PostgreSQL unquoted names are case-insensitive. So I do not see special reason to need of Upper case database name. But you can try something like:

psql -U admin -p55432 postgres -c "CREATE DATABASE \"TEST_DB\""

You can use the createdb(1) command, installed with Postgres, to create a database with an uppercase name without having to use quoting:

createdb -U admin -p55432 TEST_DB

Unless you want the database to be owned by admin, you should probably also set an owner using the -O flag.

Note: There’s also an accompanying dropdb(1) command.

You can read more about the Postgres command-line tools in the official documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .