[tz postgres support] we've to commit the connection once time-zone is set, else we may loose the setting
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 15 Apr 2011 08:22:38 +0200
changeset 7229 a60522259c2c
parent 7228 9d04e12d2d39
child 7231 18bcb98d129a
[tz postgres support] we've to commit the connection once time-zone is set, else we may loose the setting
server/sqlutils.py
--- a/server/sqlutils.py	Fri Apr 15 08:18:59 2011 +0200
+++ b/server/sqlutils.py	Fri Apr 15 08:22:38 2011 +0200
@@ -335,6 +335,9 @@
 
 def init_postgres_connexion(cnx):
     cnx.cursor().execute('SET TIME ZONE UTC')
+    # commit is needed, else setting are lost if the connection is first
+    # rollbacked
+    cnx.commit()
 
 postgres_hooks = SQL_CONNECT_HOOKS.setdefault('postgres', [])
 postgres_hooks.append(init_postgres_connexion)