Using postgres, if you rollback the first transaction on a connection, the effect of settings.TIME_ZONE is lost
|Reported by:||Michael Hudson-Doyle||Owned by:||Aymeric Augustin|
|Component:||Database layer (models, ORM)||Version:||1.3|
|Cc:||Michael Hudson-Doyle||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The fix for #3459 means that SET TIME ZONE is only called once per connection. But as per http://www.postgresql.org/docs/8.3/static/sql-set.html:
If SET (or equivalently SET SESSION) is issued within a transaction that is later aborted, the effects of the SET command disappear when the transaction is rolled back.
So if you're unlucky enough for the first transaction on a connect to get rolled back, the effect of settings.TIME_ZONE is lost for the life time of that connection -- which could quite possibly be lifetime of the process.
A simple fix would be to always COMMIT after setting the timezone -- I don't know if that would cause other problems though.