pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix formatting of to_char's EEEE output for numeric and bigint.
Date: Wed, 18 Nov 2026 17:45:44 +0000
Message-ID: <E1xTjj5-00000000GtW-34lR@gemulon.postgresql.org> (raw)

Fix formatting of to_char's EEEE output for numeric and bigint.

The integer and float code paths for EEEE format always produce a
single digit before the decimal point.  However, the numeric code
path (shared by bigint) was careless about rounding: if rounding
increased the value from, say, 9.999 to 10.00, it got printed
that way.  Fix that.  Given the precedent of the other code paths,
this seems incontestably a bug, so back-patch.

While at it, provide some actual documentation about what this
format code is supposed to do, rather than leaving it to the
reader's imagination.

Author: Jianqiao Han <hanjianqiao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAPOa_Zkc1QROJwB_JcB+f=6s1bUPRh7qr_H_=B_S-KZPa0V1DA@mail.gmail.com
Backpatch-through: 15

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4751b0490ea4965dab302b1c8e7ac7db9be3f466

Modified Files
--------------
doc/src/sgml/func.sgml                | 12 +++++++++---
src/backend/utils/adt/numeric.c       | 16 ++++++++++++++++
src/test/regress/expected/numeric.out | 24 ++++++++++++++++++++++++
src/test/regress/sql/numeric.sql      | 13 +++++++++++++
4 files changed, 62 insertions(+), 3 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1xTjj5-00000000GtW-34lR@gemulon.postgresql.org>
Permalink:  ../E1xTjj5-00000000GtW-34lR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xTjj5-00000000GtW-34lR@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix formatting of to_char's EEEE output for numeric and bigint.
  In-Reply-To: <E1xTjj5-00000000GtW-34lR@gemulon.postgresql.org>
  References: <E1xTjj5-00000000GtW-34lR@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox