summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 05591d3)
raw | patch | inline | side by side (parent: 05591d3)
author | ber <ber@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 1 Jul 2011 15:05:09 +0000 (15:05 +0000) | ||
committer | ber <ber@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 1 Jul 2011 15:05:09 +0000 (15:05 +0000) |
for PostgreSQL versions >= 8.1 as the table "postgres" is used by default.
Closes issue2550543. Thanks to Kai Storbeck for the patch.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4626 57a73879-2fb5-44c3-a270-3262357dd7e2
Closes issue2550543. Thanks to Kai Storbeck for the patch.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4626 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/backends/back_postgresql.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 7a8597a7c87648bbc217ce352a6154a18e34024a..59687934a7983498d9c3a50909312a4ec76743f8 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
- Xapian indexing improved: Slightly faster and slightly smaller database.
Closes issue2550687. Thanks to Olly Betts for the patch. (Bernhard Reiter)
+- PostgreSQL backend minor improvement: database creation less likely to fail
+ for PostgreSQL versions >= 8.1 as the table "postgres" is used by default.
+ Closes issue2550543. Thanks to Kai Storbeck for the patch. (Bernhard Reiter)
Fixed:
index 098126281449106c4afaa97885a4e2fa9aa031a8..defa905e2dfb3db5145dd63f5170bfd5d142d8d0 100644 (file)
if os.path.exists(config.DATABASE):
shutil.rmtree(config.DATABASE)
-def db_command(config, command):
+def db_command(config, command, database='postgres'):
'''Perform some sort of database-level command. Retry 10 times if we
fail by conflicting with another user.
+
+ Since PostgreSQL version 8.1 there is a database "postgres",
+ before "template1" seems to habe been used, so we fall back to it.
+ Compare to issue2550543.
'''
template1 = connection_dict(config)
- template1['database'] = 'template1'
+ template1['database'] = database
try:
conn = psycopg.connect(**template1)
except psycopg.OperationalError, message:
+ if str(message).find('database "postgres" does not exist') >= 0:
+ return db_command(config, command, database='template1')
raise hyperdb.DatabaseError(message)
conn.set_isolation_level(0)