| From: | "Josh Berkus" <agliodbs(at)openoffice(dot)org> |
|---|---|
| To: | Joseph Barillari <jbarilla(at)princeton(dot)edu>, pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Odd behavior with timestamp/interval arithmetic |
| Date: | 2002-05-03 21:59:03 |
| Message-ID: | web-1393514@davinci.ethosmedia.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Joe,
> Adding an interval to a timestamp produces the expected result:
>
> cal=> select timestamp without time zone 'jan 1, 1999 00:00:00' +
> interval '1 month';
> ?column?
> ---------------------
> 1999-02-01 00:00:00
> (1 row)
>
> But reversing the two produces nonsense: is this because the values
> are implicitly cast to type of the leftmost term in the expression?
No. It's a bug. The expression interval + timestamp was accidentally
left undefined in PostgreSQL 7.2.
You can fix it by using a CREATE OPERATOR statement to define Interval
+ timestamp.
-Josh Berkus
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2002-05-03 22:24:01 | Re: Returning composite types from a plpgsql function |
| Previous Message | Joseph Barillari | 2002-05-03 21:24:40 | Returning composite types from a plpgsql function |