pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDifference in DATEs
3+ messages / 2 participants
[nested] [flat]
* Difference in DATEs
@ 2004-09-21 07:38 Dean Gibson (DB Administrator) <postgresql3@ultimeth.com>
2004-09-21 14:01 ` Re: Difference in DATEs Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Dean Gibson (DB Administrator) @ 2004-09-21 07:38 UTC (permalink / raw)
To: pgsql-sql
Assume that x and y are of type DATE:
1. AGE( x, y ) < INTERVAL '...' works.
2. x < y + INTERVAL '...' works.
3. x - y < INTERVAL '...' doesn't work (but then, the minus operator is not
defined in the manual for two DATE values).
Question: Is the meaning of x - y well-defined? That is, is there a
definition that I can count on?
Not an important question, but I'm curious, since I like to write date
differences in a style that makes readability/maintenance easy.
-- Dean
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Difference in DATEs
2004-09-21 07:38 Difference in DATEs Dean Gibson (DB Administrator) <postgresql3@ultimeth.com>
@ 2004-09-21 14:01 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2004-09-21 14:01 UTC (permalink / raw)
To: Dean Gibson (DB Administrator) <postgresql3@ultimeth.com>; +Cc: pgsql-sql
"Dean Gibson (DB Administrator)" <postgresql3@ultimeth.com> writes:
> 3. x - y < INTERVAL '...' doesn't work (but then, the minus operator is not
> defined in the manual for two DATE values).
Sure it is: see 10th row in
http://www.postgresql.org/docs/7.4/static/functions-datetime.html#OPERATORS-DATETIME-TABLE
Forget the interval and compare to an integer.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Difference in DATEs
@ 2004-09-21 15:53 Dean Gibson (DB Administrator) <postgresql3@ultimeth.com>
0 siblings, 0 replies; 3+ messages in thread
From: Dean Gibson (DB Administrator) @ 2004-09-21 15:53 UTC (permalink / raw)
To: pgsql-sql
Tom Lane wrote on 2004-09-21 07:01:
>Sure it is: see 10th row in
>http://www.postgresql.org/docs/7.4/static/functions-datetime.html#OPERATORS-DATETIME-TABLE
>
>Forget the interval and compare to an integer.
Thanks; that line is not present in the table in the 7.3.4 docs.
-- Dean
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-09-21 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-21 07:38 Difference in DATEs Dean Gibson (DB Administrator) <postgresql3@ultimeth.com>
2004-09-21 14:01 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-09-21 15:53 Re: Difference in DATEs Dean Gibson (DB Administrator) <postgresql3@ultimeth.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox