From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Piotr Marcinczyk <pmarcinc(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Improve timestamp substraction to be DST-aware |
Date: | 2013-12-01 22:40:44 |
Message-ID: | 7211.1385937644@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Piotr Marcinczyk <pmarcinc(at)gmail(dot)com> writes:
> I would like to implement item from TODO list: "Improve TIMESTAMP WITH
> TIME ZONE subtraction to be DST-aware".
> To compute interval properly, we need time zone. Currently in timestamp
> we don't have time zone information, so I would use actual session time
> zone for computations. This can cause problems in the future, when TZ
> info will be saved in DB (this is also on TODO list). In such case, user
> may suspect, that stored TZ will be used, and probably behavior of
> subtraction will change. Anyway, I think, that using session TZ now is
> better than not using it at all.
TBH, that doesn't sound like an especially great idea from here. The
value of a timestamp difference is currently exact, but you're proposing
to make it fuzzy and context-dependent.
The alternative proposal that's been on the table for awhile (see the
preceding entry in the TODO list) is to remove the interval_justify_hours
call in timestamp_mi, which would also have the effect of fixing the
inconsistency that T1 + (T2 - T1) doesn't necessarily yield T2. And it
would do that a lot more straightforwardly, with less risk that there's
still corner cases that would misbehave.
If it's not the T1 + (T2 - T1) issue that's bothering you, perhaps
you should explain exactly what results you're hoping to get by changing
this behavior.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2013-12-01 22:54:06 | Re: Incomplete freezing when truncating a relation during vacuum |
Previous Message | Piotr Marcinczyk | 2013-12-01 22:18:03 | Improve timestamp substraction to be DST-aware |