Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH

From: Mark Douglas <mark(at)steelhousemedia(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5031: DATE_TRUNC returns the wrong value when specifying MONTH
Date: 2009-09-03 19:19:15
Message-ID: C6C564C3.103D%mark@steelhousemedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

You're correct. When I run this from psql it returns the correct result. When I run it from DBVisualizer, which I normally use, it adjust the result to my local time zone. Thanks for looking into it. Sorry about bugging you with that.

Thanks,

Mark

On 9/2/09 10:24 PM, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

Mark Douglas <mark(at)steelhousemedia(dot)com> writes:
> I have my timezone set to GMT so there really shouldn't be any time zone adjustments.

Okay ...

postgres=# set timezone = GMT;
SET
postgres=# SELECT DATE_TRUNC('MONTH', CURRENT_DATE);
date_trunc
------------------------
2009-09-01 00:00:00+00
(1 row)

I suspect there's something you're not telling us, like you're
using a client-side library that is doing timezone adjustments
behind your back.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Raja Rayaprol 2009-09-03 20:53:14 BUG #5033: Fallback using Warm Standby
Previous Message Alvaro Herrera 2009-09-03 16:01:49 Re: lost statistics; analyze needs to execute twice