Can't create a database using psql
postgresql, psql
Solution
This worked for me
instead of calling created `database.sql` file
psql -U postgres -d postgres -c "CREATE DATABASE "\"RStar"\" WITH OWNER = postgres ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'English_United States.1252' LC_CTYPE = 'English_United States.1252' CONNECTION LIMIT = -1"
- I should use "escape" character in the database name because the database name is mixed-case - `"\"RStar"\"`
OS: Windows
Problem
Am trying to create Database in PostgreSQL using `psql`, for this I have created a `database.sql` file which contains the following script database.sql ``` CREATE DATABASE "RStar" WITH OWNER = postgres ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'English_United States.1252' LC_CTYPE = 'English_United States.1252' CONNECTION LIMIT = -1; ``` using the above script I can create the database `RStar` manually(via `pgAdmin`) when I try to do the same using `psql`, I get this error: and I use the following script to call `database.sql` file using `psql` ``` psql -U postgres -d postgres -a -f "D:\PG\Database.sql" ```