failed save() with postgresql sometimes doesn't throw error until next statement (which is 'set time zone')
I was getting a 'programmingerror' when the session middleware tried to set the timezone, but as this works any other time it changes the session, I assumed that wasn't the real problem. executing the set time zone statement in psql worked too, so it seemed to be an earlier statement that was causing the error. I eventually tracked down the earlier statement that was causing the error (trying to set a DateField to a time.time() rather than a datetime instance) but what I don't understand is why this error wasn't reported when it happened.
I wondered if it was something to do with autocommit not happening until after the session had been updated so I used the manual transaction decorator to ensure the transaction was commited, but still no error. I noticed in ticket 852, kkennedy@… talks about the same behaviour. is psycopg not reporting the errors or is this a problem in django?
Change History
(8)
| Needs tests: |
set
|
| Summary: |
failed save() doesn't throw error until next statement (which is 'set time zone') → failed save() with postgresql sometimes doesn't throw error until next statement (which is 'set time zone')
|
| Triage Stage: |
Unreviewed → Accepted
|
| Severity: |
normal → Normal
|
| Type: |
defect → Bug
|
| Easy pickings: |
unset
|
| Triage Stage: |
Accepted → Ready for checkin
|
| UI/UX: |
unset
|
| Has patch: |
set
|
| Needs tests: |
unset
|
| Triage Stage: |
Ready for checkin → Accepted
|
| Owner: |
changed from nobody to zefciu
|
| Status: |
new → assigned
|
| Has patch: |
unset
|
| Resolution: |
→ worksforme
|
| Status: |
assigned → closed
|
As far as I know, the reason why sometimes an error is not detected with postgresql before the
set timezoneis still unknown, but I have seen enough reports in the mailing lists that I'm sure this is an issue. Any help in sorting this out appreciated. If you can provide a reproducible test case, please describe it here!