Re: to_char(OF) is broken

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: to_char(OF) is broken
Date: 2016-03-17 02:23:02
Message-ID: CAEepm=2PE=UKa2RMTyoMBZ7dB+93v=9YyoBqHzUKZu6jt5czeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Mar 17, 2016 at 3:02 AM, David Fetter <david(at)fetter(dot)org> wrote:
> Folks,
>
> In to_char(), the new-in-9.4 'OF' feature is straight-up broken, to
> wit:
>
> set timezone to 'America/Caracas'; select to_char(now(), 'OF');
> SET
> to_char
> ─────────
> -04:-30
> ^OK ^NOT OK
>
> Interestingly, in git master as of yesterday, it's broken in an
> entirely different way:
>
> set timezone to 'America/Caracas'; select to_char(now(), 'OF');
> SET
> to_char
> ─────────
> -004:30
> ^ What's this extra zero doing here?
> (1 row)
>
> Fractional offset time zones should probably be in our regression test
> suite for this feature.

It looks like 2d87eedc made adjustments in accounting for padding
negative numbers in several places, but the case of OF is different
than the other places because it also has a sign for positive numbers,
so no adjustment was necessary there. See attached.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
caracas.patch application/octet-stream 2.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-03-17 02:30:06 Re: [HACKERS] pgbench -C -M prepared gives an error
Previous Message Tatsuo Ishii 2016-03-17 01:38:30 Re: pgbench -C -M prepared gives an error