Re: [SQL] Problem with intervals

2003-12-02 Thread Bob Smith
On Tuesday, Dec 2, 2003, at 03:53 US/Pacific, Alexander M. Pravking wrote: On Mon, Dec 01, 2003 at 09:09:20PM -0800, Bob Smith wrote: I'm getting an unexpected result using intervals in an expression: select ('2003-10-26 0:00:00'::timestamp + '1 day'::interval)::date; date 2003

Re: [SQL] Problem with intervals

2003-12-02 Thread Tom Lane
Bob Smith <[EMAIL PROTECTED]> writes: > '1 day' just means '24 hours' Yup. > Is this a Postgres bug, or is this correct SQL behavior? It's arguably a bug, but it's unfixable without a significant change in the internal representation and handling of intervals. I don't know when anyone will get

Re: [SQL] Problem with intervals

2003-12-02 Thread Alexander M. Pravking
On Mon, Dec 01, 2003 at 09:09:20PM -0800, Bob Smith wrote: > I'm getting an unexpected result using intervals in an expression: > > select ('2003-10-26 0:00:00'::timestamp + '1 day'::interval)::date; > date > > 2003-10-26 > (1 row) Try using '2003-10-26 0:00:00'::date + 1; integ

Re: [SQL] Problem with intervals

2003-12-02 Thread Richard Huxton
On Tuesday 02 December 2003 05:09, Bob Smith wrote: > I'm getting an unexpected result using intervals in an expression: > > select ('2003-10-26 0:00:00'::timestamp + '1 day'::interval)::date; > date > > 2003-10-26 > I assumed '1 day' would always increment the date by 1, but i

[SQL] Problem with intervals

2003-12-01 Thread Bob Smith
I'm getting an unexpected result using intervals in an expression: select ('2003-10-26 0:00:00'::timestamp + '1 day'::interval)::date; date 2003-10-26 (1 row) When I get rid of the date cast it becomes clear what is happening: select '2003-10-26 0:00:00'::timestamp + '1 day'::in