[openstreetmap-website] Switch to TIMESTAMP WITH TIME ZONE for current_* tables (#375)

Matt Amos notifications at github.com
Wed Jul 24 11:56:57 UTC 2013


> It's not as clean a solution as altering the db schema (because it requires
> the client to modify its sql queries and it requires the client code to know
> what timezone the server's timestamps actualy are in), but it avoid the
> lenghty "alter table".

The server's timestamps are actually in UTC. Therefore it seems the cleanest solution is fixing the bugs in the client where they are assuming, incorrectly, that they're in local time.

>> I also need to try inserting by hand to see what results I get

> ```sql
>     tokill=# show time zone;
>      Europe/Paris
>     tokill=# \d foo
>      d_notz | timestamp without time zone | 
>      d_tz   | timestamp with time zone    | 
>     tokill=# insert into foo values ('2013/01/01 00:00:00', '2013/01/01 00:00:00'),('2013/01/01 00:00:00', '2013/01/01 00:00:00' at time zone 'utc');
>     INSERT 0 2
>     tokill=# select d_notz, d_notz at time zone 'utc', d_tz from foo;
>      2013-01-01 00:00:00 | 2013-01-01 01:00:00+01 | 2013-01-01 00:00:00+01
>      2013-01-01 00:00:00 | 2013-01-01 01:00:00+01 | 2012-12-31 23:00:00+01
> ```

This looks to me like the `d_notz` column is exactly what we want: Put the data in and take it out without the server messing with it. We just have to stop the client messing with it also.


---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/375#issuecomment-21479654
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20130724/080c103e/attachment.html>


More information about the rails-dev mailing list