Skip to content

Commit f7cc42e

Browse files
author
Ralf Schlatterbeck
committed
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.
1 parent 669e632 commit f7cc42e

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

CHANGES.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ Fixed:
4242
(Ralf Schlatterbeck)
4343
- Fix incorrect setting of template in customizing.txt example action,
4444
patch via issue2550682 (thanks John Kristensen)
45+
- Configuration issue: On some postgresql 8.4 installations (notably on
46+
debian squeeze) the default template database used for database
47+
creation doesn't match the needed character encoding UTF8 -- a new
48+
config option 'template' in the rdbms section now allows specification
49+
of the template. You know you need this option if you get the error
50+
message:
51+
psycopg2.DataError: new encoding (UTF8) is incompatible with the
52+
encoding of the template database (SQL_ASCII)
53+
HINT: Use the same encoding as in the template database, or use
54+
template0 as template.
55+
(Ralf Schlatterbeck)
4556

4657

4758
2010-10-08 1.4.16 (r4541)

roundup/backends/back_postgresql.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def connection_dict(config, dbnamestr=None):
3636
def db_create(config):
3737
"""Clear all database contents and drop database itself"""
3838
command = "CREATE DATABASE %s WITH ENCODING='UNICODE'"%config.RDBMS_NAME
39+
if config.RDBMS_TEMPLATE :
40+
command = command + " TEMPLATE=%s" % config.RDBMS_TEMPLATE
3941
logging.getLogger('roundup.hyperdb').info(command)
4042
db_command(config, command)
4143

roundup/configuration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,18 @@ def str2value(self, value):
610610
"Only used in SQLite connections."),
611611
(IntegerNumberOption, 'cache_size', '100',
612612
"Size of the node cache (in elements)"),
613+
(NullableOption, 'template', '',
614+
"Name of the PostgreSQL template for database creation.\n"
615+
"For database creation the template used has to match\n"
616+
"the character encoding used (UTF8), there are different\n"
617+
"PostgreSQL installations using different templates with\n"
618+
"different encodings. If you get an error:\n"
619+
" new encoding (UTF8) is incompatible with the encoding of\n"
620+
" the template database (SQL_ASCII)\n"
621+
" HINT: Use the same encoding as in the template database,\n"
622+
" or use template0 as template.\n"
623+
"then set this option to the template name given in the\n"
624+
"error message."),
613625
), "Settings in this section are used"
614626
" by RDBMS backends only"
615627
),

0 commit comments

Comments
 (0)