Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyphen in postgresql username throws syntax error #8

Closed
cireficc opened this issue Dec 29, 2016 · 1 comment
Closed

Hyphen in postgresql username throws syntax error #8

cireficc opened this issue Dec 29, 2016 · 1 comment

Comments

@cireficc
Copy link

cireficc commented Dec 29, 2016

This one is pretty simple, but poses a problem:

Creating Postgres 'feasibility-thredded_dev' user.
ERROR:  syntax error at or near "-"
LINE 1: CREATE ROLE feasibility-thredded_dev LOGIN PASSWORD 'feasibi...
                               ^
ERROR:  syntax error at or near "-"
LINE 1: ALTER ROLE feasibility-thredded_dev CREATEDB;

I named the app feasibility-thredded, which in turn tried to create Postgres user feasibility-thredded_dev, however because of the hyphen - , there is a syntax error.

According to this PG message board topic, it simply needs to be wrapped in double quotes.

Changing L23/24 in create_database_user.sh from:

CREATE ROLE $USER LOGIN PASSWORD '$PASS';
ALTER ROLE $USER CREATEDB;

to

CREATE ROLE "$USER" LOGIN PASSWORD '$PASS';
ALTER ROLE "$USER" CREATEDB;

solves the problem.

@cireficc
Copy link
Author

It was an easy fix so I just did it myself and opened a PR :)

@glebm glebm closed this as completed in #9 Dec 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant