Bug in date arithmetic

From: David Fetter <david(at)fetter(dot)org>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Bug in date arithmetic
Date: 2009-08-24 16:12:07
Message-ID: 20090824161207.GE5896@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 or terminate with semicolon to execute query
\q to quit

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

shackle(at)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(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-24 16:14:56 Re: DELETE syntax on JOINS
Previous Message Bruce Momjian 2009-08-24 16:02:48 Re: DELETE syntax on JOINS