Database creation fails with syntax error
Bug #1172086 reported by Sidnei da Silva
This bug affects 1 person
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| postgresql (Juju Charms Collection) | Fix Released | Undecided | Sidnei da Silva | ||
Bug Description
Current code in the charm doesn't do any quoting around the database name:
postgres=# CREATE DATABASE u1-app-be;
ERROR: syntax error at or near "-"
LINE 1: CREATE DATABASE u1-app-be;
Tried changing to pass params to psycopg2, but that also fails in a slightly different way:
postgres=# CREATE DATABASE 'u1-app-be';
ERROR: syntax error at or near "'u1-app-be'"
LINE 1: CREATE DATABASE 'u1-app-be';
Using double quotes seems to work around it, but not sure how to do this in the right way with psycopg2 and params:
postgres=# CREATE DATABASE "u1-app-be";
CREATE DATABASE
Related branches
lp:~sidnei/charms/precise/postgresql/trunk
- Marco Ceppi (community): Approve
- Diff: 760 lines (+216/-137)5 files modifiedconfig.yaml (+4/-0)
hooks/hooks.py (+210/-136)
revision (+0/-1)
templates/pg_hba.conf.tmpl (+1/-0)
templates/postgres.cron.tmpl (+1/-0)
| Changed in postgresql (Juju Charms Collection): | |
| assignee: | nobody → Sidnei da Silva (sidnei) |
| status: | New → Fix Released |
To post a comment you must log in.
Linked branch changes to use params but doesn't fix the issue mentioned above.