postgresql - Can't create a database using psql -


am trying create database in postgresql using psql, have created database.sql file contains following script

database.sql

create database "rstar"  owner = postgres  encoding = 'utf8' tablespace = pg_default  lc_collate = 'english_united states.1252' lc_ctype = 'english_united states.1252'    connection limit = -1; 
  • using above script can create database rstar manually(via pgadmin)

  • when try same using psql, error:

enter image description here

and use following script call database.sql file using psql

psql -u postgres  -d postgres -a -f  "d:\pg\database.sql"  

this worked me

instead of calling created database.sql file

 psql -u postgres  -d postgres -c "create database "\"rstar"\"  owner = postgres encoding = 'utf8' tablespace = pg_default lc_collate = 'english_united states.1252' lc_ctype = 'english_united states.1252' connection limit = -1" 
  • should use ecape character database name because in case database name mixed-case rstar in create script need include escape character i.e "\"rstar"\"

os: windows


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -