Bug in date arithmetic - Mailing list pgsql-hackers

From David Fetter
Subject Bug in date arithmetic
Date
Msg-id 20090824161207.GE5896@fetter.org
Whole thread Raw
Responses Re: Bug in date arithmetic  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Bug in date arithmetic  (Sam Mason <sam@samason.me.uk>)
List pgsql-hackers
Folks,

While debugging an error with Aziz (postgres_newbie) Sharief in the
#postgresql IRC channel, I found a major POLA violation:

$ psql
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help with psql commands      \g
orterminate with semicolon to execute query      \q to quit
 

shackle@shackle:5432=# SELECT now() + '900000';          ?column?            
-------------------------------2009-09-03 19:03:43.195514-07
(1 row)

shackle@shackle:5432=# SELECT now() - '900000';
ERROR:  date/time field value out of range: "900000"
HINT:  Perhaps you need a different "datestyle" setting.

I'd be tempted to call it a flat-out bug in the first case.  Adding a
string literal to a timestamptz should just result in an error, IMHO.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: DELETE syntax on JOINS
Next
From: Alvaro Herrera
Date:
Subject: Re: DELETE syntax on JOINS