date_trunc should be called date_round? - Mailing list pgsql-sql

From Mario Splivalo
Subject date_trunc should be called date_round?
Date
Msg-id 4A487F94.3070303@megafon.hr
Whole thread Raw
Responses Re: date_trunc should be called date_round?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
It's stated in the docs that date_trunc is "conceptually similar to the
trunc function for numbers.".

So, trunc(1.1) = 1, trunc(1.9) = 1, and so on.

But, date_trunc behaves like round function: round(1.9) = 2.

Example:

idel=# select date_trunc('milliseconds', '2009-01-01
12:15:00.000999+02'::timestamp with time zone);        date_trunc
----------------------------2009-01-01 11:15:00.001+01
(1 row)

fidel=# select version();                                                version

----------------------------------------------------------------------------------------------------------PostgreSQL
8.3.7on x86_64-unknown-linux-gnu, compiled by GCC
 
gcc-4.3.real (Ubuntu 4.3.3-5ubuntu4) 4.3.3
(1 row)


Or am I again completely misreading something?
Mike


pgsql-sql by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: uniqueness constraint with NULLs
Next
From: Craig Ringer
Date:
Subject: Re: uniqueness constraint with NULLs