Feature #2840
closedDbo Postgres backend: Support WDateTime in TIMEStAMP WITH TIME ZONE columns
0%
Description
By default, the Dbo backend for Postgres creates TIMESTAMP columns to hold WDateTimes. However, legacy tables may include TIMESTAMP WITH TIME ZONE columns. For instance, Django creates datetime columns with this option.
Dbo will currently write WDateTime values to TIMESTAMP WITH TIME ZONE columns, but the values will be incorrect unless the client is configured with a UTC timezone. Postgres assumes the timestamp values are in localtime and will adjust them to UTC.
Dbo will read WDateTime values from TIMESTAMP WITH TIME ZONE columns, but silently ignores the timezone offset that Postgres appends --- if the offset is negative. If the timezone offset is not negative, a bad lexical cast is thrown.
I've attached a patch with some test cases to illustrate the issue. The tests dbo_test22a and dbo_test22b provide negative and positive timezone offsets, leaving the default TIMESTAMP column. They should succeed. The tests dbo_test22c and dbo_test22d, are analogous but alter the table to use TIMESTAMP WITH TIME ZONE columns. They should fail.
For your review, I've also included a patch to the Dbo backend for Postgres which seems to help in limited testing.
Files
Updated by Koen Deforche about 11 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.3.3