Re: Time intervals in select statement - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Time intervals in select statement
Date
Msg-id 15348.1098194168@sss.pgh.pa.us
Whole thread Raw
In response to Re: Time intervals in select statement  (Luke McFarlane <luke@fisheye.com.au>)
List pgsql-bugs
Luke McFarlane <luke@fisheye.com.au> writes:
> It's interesting why addition assumes one operand is interval while
> subtraction assumes it is timestamp? It should at least be consistent, IMHO.

There is no timestamp + timestamp operator, for reasons that should be
fairly apparent.  There are both timestamp - timestamp (yielding interval)
and timestamp - interval (yielding timestamp), and in case of ambiguity
the preferred interpretation is the one with the same datatype on both
sides.  See
http://www.postgresql.org/docs/7.4/static/typeconv-oper.html

            regards, tom lane

pgsql-bugs by date:

Previous
From: Theodore Petrosky
Date:
Subject: Re: Mac OS X make check errors...
Next
From: Jaime Casanova
Date:
Subject: a bug in pg_dump?