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(viapgadmin
)when try same using
psql
, error:
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
Post a Comment