Re: BUG #12754: The 'OF' template pattern of to_char() print incorrect results with negative offsets with minutes

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: david(dot)pozsar(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #12754: The 'OF' template pattern of to_char() print incorrect results with negative offsets with minutes
Date: 2015-04-29 01:03:15
Message-ID: 20150429010315.GH31727@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 10, 2015 at 09:56:58AM +0000, david(dot)pozsar(at)gmail(dot)com wrote:
> The following bug has been logged on the website:
>
> Bug reference: 12754
> Logged by: David Pozsar
> Email address: david(dot)pozsar(at)gmail(dot)com
> PostgreSQL version: 9.4.0
> Operating system: Windows 7
> Description:
>
> If the current time-zone has minutes and is negative, to_char('OF') prints a
> negative sign before the minute part too.
>
> Code, to reproduce:
>
> set time zone interval '-02:30';
> -- or: set timezone to -2.5;
> select ts::text, to_char(ts, 'YYYY-MM-DD HH24:MI:SSOF')
> from (values (timestamptz '2015-02-10 07:05:15+00')) v(ts);
>
> Output:
>
> ts | to_char
> ---------------------------+----------------------------
> 2015-02-10 04:35:15-02:30 | 2015-02-10 04:35:15-02:-30
>
> Expected output:
>
> ts | to_char
> ---------------------------+---------------------------
> 2015-02-10 04:35:15-02:30 | 2015-02-10 04:35:15-02:30

Attached patch applied. Thanks for the clear report.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
to_char.diff text/x-diff 709 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2015-04-29 04:30:58 Re: BUG #13126: table constraint loses its comment
Previous Message Thomas Munro 2015-04-29 00:14:11 Re: Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)