Reputation: 315
I have installed PostgreSQL 9.4.6 in docker image with docker version 1.10.1. According to this official image: https://github.com/docker-library/postgres/blob/443c7947d548b1c607e06f7a75ca475de7ff3284/9.4/Dockerfile As it is said here , that to create initial databases I add my sql script in "/docker-entrypoint-initdb.d" . https://hub.docker.com/_/postgres/ Now after having some trouble I found that when I add query to create a database in sql script where database name has '-' ,they just cause the container to crash(i.e. the containers exits just after starting). But query with having no '-' in database name works fine and container also doesn't crash and i can access those database. For example, This query runs fine.
create database 1stName_2ndName with owner vagrant;
But I tried both of this queries individually and it fails for both cases
create database '1stName-2ndName' with owner vagrant;
or
create database 1stName-2ndName with owner vagrant;
Note: consider queries without double-quotation. vagrant user is already created and works fine.
I have a database which name is 1stName-2ndName. Can anybody help me to figure out the issue?
Upvotes: 2
Views: 285
Reputation: 18173
At my local Postgres installation, the following query works without a problem:
create database "1stName-2ndName" with owner vagrant;
Upvotes: 1