Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Bruce Momjian
Andrew - Supernews wrote: > On 2005-10-26, Tom Lane <[EMAIL PROTECTED]> wrote: > > Andrew - Supernews <[EMAIL PROTECTED]> writes: > >> Um, what? Under what conditions is it permissable for simple arithmetic on > >> (only) timestamptz values (which may have originated in different timezones > >> nei

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Andrew - Supernews
On 2005-10-26, Tom Lane <[EMAIL PROTECTED]> wrote: > Andrew - Supernews <[EMAIL PROTECTED]> writes: >> Um, what? Under what conditions is it permissable for simple arithmetic on >> (only) timestamptz values (which may have originated in different timezones >> neither of which is the current one) to

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Tom Lane
Andrew - Supernews <[EMAIL PROTECTED]> writes: > Um, what? Under what conditions is it permissable for simple arithmetic on > (only) timestamptz values (which may have originated in different timezones > neither of which is the current one) to be dependent on the current timezone > setting? Timest

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Tom Lane
Bruce Momjian writes: > I saw a lot of disussion because I forgot to specify that my tests were > for EST5EDT, but what about the use of interval_justify_hours() in > timestamp_mi(). Is this something we want to change? It's too late to mess with it for 8.1, but see my previous message proposing

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Nicholas Vinen
Thanks for all this discussion, fixing, etc. I'm currently having "issues" getting postgres' date/time functions to do what I want. You have obviously spotted some of the reasons for this. Many of my issues disappear when I use 8.1, but it's still in beta. Is it safe for me to use 8.1 in pro

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Bruce Momjian
I saw a lot of disussion because I forgot to specify that my tests were for EST5EDT, but what about the use of interval_justify_hours() in timestamp_mi(). Is this something we want to change? --- Bruce Momjian wrote: > Klin

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Bruce Momjian
John R Pierce wrote: > >>test=> select > >>test-> ('2005-10-30 13:22:00-05'::timestamptz - > >>test(> '2005-10-29 13:22:00-04'::timestamptz); > >> ?column? > >>-- > >> 25:00:00 > >>(1 row) > > > > > > Is that actually the correct answer? > > > > Disregarding

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Andrew - Supernews
On 2005-10-26, Klint Gore <[EMAIL PROTECTED]> wrote: > [sorry about the previous email, I quoted the wrong bit and clicked the > wrong button] > > On Tue, 25 Oct 2005 23:41:54 -0400 (EDT), Bruce Momjian > wrote: >> test=> select >> test-> ('2005-10-30 13:22:00-05'::timestamptz - >> t

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-26 Thread Andrew - Supernews
On 2005-10-26, Tom Lane <[EMAIL PROTECTED]> wrote: > John R Pierce <[EMAIL PROTECTED]> writes: >> the whole DST thing falls apart when you deal with places that don't >> respect it... arizona (except the navajo nation), for instance > >> it would be impossible to calculate the 'correct' answe

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Andrew - Supernews
On 2005-10-26, Tom Lane <[EMAIL PROTECTED]> wrote: > Klint Gore <[EMAIL PROTECTED]> writes: >> On Tue, 25 Oct 2005 23:41:54 -0400 (EDT), Bruce Momjian >> wrote: >>> test=> select >>> test-> ('2005-10-30 13:22:00-05'::timestamptz - >>> test(> '2005-10-29 13:22:00-04'::timestamptz); >>> ?column? >>

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Tom Lane
John R Pierce <[EMAIL PROTECTED]> writes: > heh. as an aside... the original reason I got ON this and the jdbc > list was due to an issue we had with an inhouse java+pgsql program when > it was deployed in Singapore... SGT wasn't recognized, then I > discovered that China (another later deplo

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Klint Gore
On Wed, 26 Oct 2005 00:44:50 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > John R Pierce <[EMAIL PROTECTED]> writes: > > the whole DST thing falls apart when you deal with places that don't > > respect it... arizona (except the navajo nation), for instance > > > it would be impossible to calc

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Tom Lane
Klint Gore <[EMAIL PROTECTED]> writes: > I think this is what I was getting at. In my timezone 'Australia/NSW', > we have daylight savings. Is that used any way when the calculation > happens or the result is displayed? Absolutely. The examples Bruce and I have been throwing around assume US Ea

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Tom Lane
John R Pierce <[EMAIL PROTECTED]> writes: > the whole DST thing falls apart when you deal with places that don't > respect it... arizona (except the navajo nation), for instance > it would be impossible to calculate the 'correct' answer without knowing > the exact location... No, rather sa

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread John R Pierce
test=> select test-> ('2005-10-30 13:22:00-05'::timestamptz - test(> '2005-10-29 13:22:00-04'::timestamptz); ?column? -- 25:00:00 (1 row) Is that actually the correct answer? Disregarding daylight savings, there is 25hrs betwee

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Tom Lane
Klint Gore <[EMAIL PROTECTED]> writes: > On Tue, 25 Oct 2005 23:41:54 -0400 (EDT), Bruce Momjian > wrote: >> test=> select >> test-> ('2005-10-30 13:22:00-05'::timestamptz - >> test(> '2005-10-29 13:22:00-04'::timestamptz); >> ?column? >> -- >> 25:00:00 >> (1 row) > Is that actually the

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Klint Gore
[sorry about the previous email, I quoted the wrong bit and clicked the wrong button] On Tue, 25 Oct 2005 23:41:54 -0400 (EDT), Bruce Momjian wrote: > test=> select > test-> ('2005-10-30 13:22:00-05'::timestamptz - > test(> '2005-10-29 13:22:00-04'::timestamptz); >?colu

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Klint Gore
On Tue, 25 Oct 2005 23:41:54 -0400 (EDT), Bruce Momjian wrote: > test-> ('2005-10-30 13:22:00-05'::timestamptz - > test(> '2005-10-29 13:22:00-04'::timestamptz); > ?column? > >1 day 01:00:00 +---+

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Bruce Momjian
Klint Gore wrote: > On Tue, 25 Oct 2005 13:28:00 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > > regression=# select '2005-10-29 13:22:00-04'::timestamptz + '1 > > day'::interval; > > ?column? > > > > 2005-10-30 13:22:00-05 > > (1 row) > > > > regression=# select

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Bruce Momjian
Nicholas Vinen wrote: > > Thanks for all this discussion, fixing, etc. I'm currently having > "issues" getting postgres' date/time functions to do what I want. You > have obviously spotted some of the reasons for this. > > Many of my issues disappear when I use 8.1, but it's still in beta. Is

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Klint Gore
On Tue, 25 Oct 2005 13:28:00 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: > regression=# select '2005-10-29 13:22:00-04'::timestamptz + '1 day'::interval; > ?column? > > 2005-10-30 13:22:00-05 > (1 row) > > regression=# select '2005-10-30 13:22:00-05'::timestamptz -

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Tom Lane
Bruce Momjian writes: > Tom Lane wrote: >> Right. Interval multiplication has always spilled fractional months >> over to seconds, but never the reverse. We have to have that same >> policy now for fractional days. > OK, I think that makes sense. I've applied this change to interval_mul and in

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > OK, what about 1.5 * '1 day'. By my logic multiplication and division > > were by definition imprecise. Is the logic that we spill down only for > > non-integral values? > > Right. Interval multiplication has always spilled fractional months > over t

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Tom Lane
Bruce Momjian writes: > OK, what about 1.5 * '1 day'. By my logic multiplication and division > were by definition imprecise. Is the logic that we spill down only for > non-integral values? Right. Interval multiplication has always spilled fractional months over to seconds, but never the rever

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-25 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > Tom Lane wrote: > >> Urgh. I think this is a serious thinko in Michael Glaesemann's rewrite > >> of interval_mul. > > > The reason interval_justify_hours is called by interval multiplication > > is so multipling an interval '2 days, 4 hours' by 10 does

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Tom Lane
Bruce Momjian writes: > Tom Lane wrote: >> Urgh. I think this is a serious thinko in Michael Glaesemann's rewrite >> of interval_mul. > The reason interval_justify_hours is called by interval multiplication > is so multipling an interval '2 days, 4 hours' by 10 doesn't return > values like 20 da

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Bruce Momjian
Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > Should 24 hours be the same as 1 * 24 hours? > > Yes, I would think so. > > > The latter appears to be equal to 1 day, not 24 hours: > > Urgh. I think this is a serious thinko in Michael Glaesemann's rewrite > of interval_mul. The

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > Should 24 hours be the same as 1 * 24 hours? Yes, I would think so. > The latter appears to be equal to 1 day, not 24 hours: Urgh. I think this is a serious thinko in Michael Glaesemann's rewrite of interval_mul. The application of interval_justify_ho

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Michael Fuhr
On Mon, Oct 24, 2005 at 11:21:52PM -0400, Tom Lane wrote: > Klint Gore <[EMAIL PROTECTED]> writes: > > That's changed since v7.4.7 > > Yup. '1 week' = '7 days' which is no longer the same as 7*24 hours. > In particular, as of 8.1 local noon plus one day is still local noon, > even if there was a

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Michael Fuhr
On Tue, Oct 25, 2005 at 12:48:10PM +1000, Klint Gore wrote: > On Tue, 25 Oct 2005 08:51:59 +1000, Russell Smith <[EMAIL PROTECTED]> wrote: > > Looks to mee like Daylight Savings has conveniently started. > > But the elapsed time for those results is only 6 days, 23 hours. > > That's changed since

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Tom Lane
Klint Gore <[EMAIL PROTECTED]> writes: > That's changed since v7.4.7 Yup. '1 week' = '7 days' which is no longer the same as 7*24 hours. In particular, as of 8.1 local noon plus one day is still local noon, even if there was a DST change in between. Adding 24 hours, on the other hand, might give

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Klint Gore
On Tue, 25 Oct 2005 08:51:59 +1000, Russell Smith <[EMAIL PROTECTED]> wrote: > Nicholas wrote: > > postgres=# SELECT NOW()-interval '1 week'; > >?column? > > --- > > 2005-10-17 08:52:37.355219+10 > > (1 row) > > > > postgres=# SELECT NOW()-interval '-1 week

Re: [BUGS] BUG #1993: Adding/subtracting negative time intervals

2005-10-24 Thread Russell Smith
Nicholas wrote: The following bug has been logged online: Bug reference: 1993 Logged by: Nicholas Email address: [EMAIL PROTECTED] PostgreSQL version: 8.0.3,8.0.4,8.1 Operating system: Gentoo Linux Description:Adding/subtracting negative time intervals changes time z

[BUGS] BUG #1993: Adding/subtracting negative time intervals changes time zone of result

2005-10-24 Thread Nicholas
The following bug has been logged online: Bug reference: 1993 Logged by: Nicholas Email address: [EMAIL PROTECTED] PostgreSQL version: 8.0.3,8.0.4,8.1 Operating system: Gentoo Linux Description:Adding/subtracting negative time intervals changes time zone of result Det