diff roundup/backends/back_postgresql.py @ 4471:4f353d71d716

Configuration issue: On some postgresql 8.4 installations (notably on debian squeeze) the default template database used for database creation doesn't match the needed character encoding UTF8 -- a new config option 'template' in the rdbms section now allows specification of the template. You know you need this option if you get the error message: psycopg2.DataError: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII) HINT: Use the same encoding as in the template database, or use template0 as template.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Wed, 16 Mar 2011 11:26:50 +0000
parents 67bef70ab9b9
children f6c49df25048
line wrap: on
line diff
--- a/roundup/backends/back_postgresql.py	Sat Feb 26 20:57:11 2011 +0000
+++ b/roundup/backends/back_postgresql.py	Wed Mar 16 11:26:50 2011 +0000
@@ -36,6 +36,8 @@
 def db_create(config):
     """Clear all database contents and drop database itself"""
     command = "CREATE DATABASE %s WITH ENCODING='UNICODE'"%config.RDBMS_NAME
+    if config.RDBMS_TEMPLATE :
+        command = command + " TEMPLATE=%s" % config.RDBMS_TEMPLATE
     logging.getLogger('roundup.hyperdb').info(command)
     db_command(config, command)
 

Roundup Issue Tracker: http://roundup-tracker.org/