Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id B57AF63291B for ; Mon, 29 Jun 2009 05:53:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20708-09 for ; Mon, 29 Jun 2009 05:53:19 -0300 (ADT) X-Greylist: delayed 00:05:53.16859 by SQLgrey-1.7.6 Received: from megafon.hr (megafon.hr [213.202.104.5]) by mail.postgresql.org (Postfix) with ESMTP id 7D5256328F4 for ; Mon, 29 Jun 2009 05:53:19 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by megafon.hr (Postfix) with ESMTP id 610267EC005 for ; Mon, 29 Jun 2009 10:47:23 +0200 (CEST) X-Virus-Scanned: ClamAV at megafon.hr Received: from megafon.hr ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wPfzeLie6v38 for ; Mon, 29 Jun 2009 10:47:18 +0200 (CEST) Received: from [IPv6:::1] (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mike) by megafon.hr (Postfix) with ESMTPSA id 349717EC004 for ; Mon, 29 Jun 2009 10:47:18 +0200 (CEST) Message-ID: <4A487F94.3070303@megafon.hr> Date: Mon, 29 Jun 2009 10:47:16 +0200 From: Mario Splivalo User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: pgsql Subject: date_trunc should be called date_round? Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/119 X-Sequence-Number: 32724 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.7 on 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