Adding to a date/time? - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Adding to a date/time?
Date
Msg-id 3D898626.2000403@mega-bucks.co.jp
Whole thread Raw
Responses Re: Adding to a date/time?
List pgsql-general
I'm having some trouble understanding the behaviour of one of my queries
on version 7.2. I'm sure it's because I don't understand date/times ...
Here is the query I don't understand and it's results
:
$ psql TMP -c "select id, req_del_date3 from invoices order by id"
  id |     req_del_date3
----+------------------------
   1 | 2002-09-18 00:00:00+09
  10 | 2002-09-18 00:00:00+09
  13 | 2002-09-18 00:00:00+09
  17 | 2002-09-18 00:00:00+09

$ psql TMP -c "update invoices set req_del_date3='today+8' where id > 10"
UPDATE 2
$ psql TMP -c "select id, req_del_date3 from invoices order by id"
  id |     req_del_date3
----+------------------------
   1 | 2002-09-18 00:00:00+09
  10 | 2002-09-18 00:00:00+09
  13 | 2002-09-18 01:00:00+09
  17 | 2002-09-18 01:00:00+09

Why does 'today+8' add 1 hour to the timestamp? I could have
understanding adding 8 secs, 8 hours, 8 days, or 8 of anything but it
added 1 hour? What did I miss?

I also tried this with the same results (I assumed 8d would force adding
8 *days* but no ...):

$ psql TMP -c "update invoices set req_del_date3='today+8d' where id > 10"

What does postgresQL think 8d means?

And finally what is the proper SQL to add 8days to a timestamp?

Jc


pgsql-general by date:

Previous
From: Jean-Christian Imbeault
Date:
Subject: datetime(): Where is it in the docs?
Next
From: Jean-Christian Imbeault
Date:
Subject: Re: IN vs EXIIST