[egenix-users] RelativeDateTime

Francois Girault francois.girault at clarisys.fr
Thu Jan 15 17:40:06 CET 2004


On Thu, 15 Jan 2004 11:50:55 +0100
M.-A. Lemburg wrote:

> Francois Girault wrote:
> > So the behavior we expect is the same than postgresql with interval
> > type. IMHO, postgresql (ie SQL99 interval type) has a very logical
> > point of view about this non obvious problem. What do you think
> > about that ?
> 
> Do you have a reference for this ?
> 

This directory contains many docs about SQL99 :

http://trinetra.ncb.ernet.in/education/modules/dbms/SQL99/

But I haven't found a fully explained date arithmetic.

In this document :

http://trinetra.ncb.ernet.in/education/modules/dbms/SQL99/ansi-iso-9075-2-1999.pdf

 a chapter about interval says on page 29 : "Arithmetic
operations involving values of type datetime or interval obey the
natural rules associated with dates and times and yield valid datetime
or interval results according to the Gregorian calendar."

"natural rules" are *very* ambigious, but playing with postgres tell
more about that :

=> SELECT date('2002-01-30') + "interval"('1 mon');
      ?column?       
---------------------
 2002-02-28 00:00:00
(1 row)

For date from january, 28th to january, 31th adding one month result in
the last day of february. From a math point of view, it seems wrong, but
thinking more about make me consider it 'natural'

Regards,

François Girault

Clarisys Informatique - http://www.clarisys.fr


More information about the egenix-users mailing list