Package: roundup Version: 1.4.4-2 Severity: normal Tags: upstream Hi,
"roundup-admin initialise" fails with "RuntimeError: 10 attempts to create database failed" when initializing a tracker when using the PostgreSQL backend and if the tracker name includes a dash. PostgreSQL reports the following error (in its logs, they are not directly visible to the user of roundup): syntax error at or near "-" at character 24. By quoting the tracker name in SQL queries, this can be fixed. Attached is a patch that fixes the CREATE and DROP DATABASE queries in back_postgresql.py (please note that you have to use double quotes). So far, I did not find any other queries that might cause problems, but I'm not yet using roundup in a production environment. Cheers, Sebastian -- Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/ Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
--- a/roundup/backends/back_postgresql.py
+++ b/roundup/backends/back_postgresql.py
@@ -35,13 +35,13 @@
def db_create(config):
"""Clear all database contents and drop database itself"""
- command = "CREATE DATABASE %s WITH ENCODING='UNICODE'"%config.RDBMS_NAME
+ command = "CREATE DATABASE \"%s\" WITH ENCODING='UNICODE'"%config.RDBMS_NAME
logging.getLogger('hyperdb').info(command)
db_command(config, command)
def db_nuke(config, fail_ok=0):
"""Clear all database contents and drop database itself"""
- command = 'DROP DATABASE %s'% config.RDBMS_NAME
+ command = 'DROP DATABASE "%s"'% config.RDBMS_NAME
logging.getLogger('hyperdb').info(command)
db_command(config, command)
signature.asc
Description: Digital signature

