Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U6T32-000190-2n for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Feb 2013 21:42:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U6T31-0002E7-Ie for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Feb 2013 21:42:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U6T30-0002E1-PT for pgsql-bugs@postgresql.org; Fri, 15 Feb 2013 21:42:22 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U6T2w-0008CE-T7 for pgsql-bugs@postgresql.org; Fri, 15 Feb 2013 21:42:22 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1U6T2v-0003hz-Kp; Fri, 15 Feb 2013 16:42:17 -0500 Date: Fri, 15 Feb 2013 16:42:17 -0500 From: Bruce Momjian To: nick.baxter@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7886: date_trunc(date) returning timestamptz instead of timestamp Message-ID: <20130215214217.GF12030@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Fri, Feb 15, 2013 at 09:27:40PM +0000, nick.baxter@gmail.com wrote: > The following bug has been logged on the website: > > Bug reference: 7886 > Logged by: Nick Baxter > Email address: nick.baxter@gmail.com > PostgreSQL version: 9.0.3 > Operating system: Linux 2.6.18 > Description: > > 9.9.2. indicates that date_trunc can be called with a date value (which will > be cast to a timestamp). And regardless of the input, that the result will > be of type timestamp. When I call it with a date, I get a timestamp with > time zone instead, as indicated by the psql output. > > # select date_trunc('month',date '2013-2-15'); > date_trunc > ------------------------ > 2013-02-01 00:00:00-06 > (1 row) That documentation often uses timestamp when it means timestamp with time zone. Not sure why that is. \df shows the supported functions: test=> \df date_trunc List of functions Schema | Name | Result data type | Argument data types | Type ------------+------------+-----------------------------+-----------------------------------+-------- pg_catalog | date_trunc | interval | text, interval | normal pg_catalog | date_trunc | timestamp without time zone | text, timestamp without time zone | normal pg_catalog | date_trunc | timestamp with time zone | text, timestamp with time zone | normal This returns a timestamp without time zone: test=> select date_trunc('month',timestamp '2013-2-15'); date_trunc --------------------- 2013-02-01 00:00:00 (1 row) -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs