pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix loss of fractional digits for large values in cash_numeric()
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix loss of fractional digits for large values in cash_numeric()
@ 2019-07-26 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-07-26 16:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix loss of fractional digits for large values in cash_numeric().

Money values exceeding about 18 digits (depending on lc_monetary)
could be inaccurately converted to numeric, due to select_div_scale()
deciding it didn't need to compute any fractional digits.  Force
its hand by setting the dscale of one division input to equal the
number of fractional digits we need.

In passing, rearrange the logic to not do useless work in locales
where money values are considered integral.

Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/01e0538e8b12591283835a2ff629428262684574

Modified Files
--------------
src/backend/utils/adt/cash.c        | 56 ++++++++++++++++++++++++-------------
src/test/regress/expected/money.out | 16 ++++++++++-
src/test/regress/sql/money.sql      |  6 +++-
3 files changed, 57 insertions(+), 21 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix loss of fractional digits for large values in cash_numeric()
@ 2019-07-26 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-07-26 16:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix loss of fractional digits for large values in cash_numeric().

Money values exceeding about 18 digits (depending on lc_monetary)
could be inaccurately converted to numeric, due to select_div_scale()
deciding it didn't need to compute any fractional digits.  Force
its hand by setting the dscale of one division input to equal the
number of fractional digits we need.

In passing, rearrange the logic to not do useless work in locales
where money values are considered integral.

Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/13e493cf68a4ed8a54e974c41470fab43676e67c

Modified Files
--------------
src/backend/utils/adt/cash.c        | 58 ++++++++++++++++++++++++-------------
src/test/regress/expected/money.out | 41 +++++++++++++++++++++++++-
src/test/regress/sql/money.sql      | 12 +++++++-
3 files changed, 89 insertions(+), 22 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix loss of fractional digits for large values in cash_numeric()
@ 2019-07-26 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-07-26 16:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix loss of fractional digits for large values in cash_numeric().

Money values exceeding about 18 digits (depending on lc_monetary)
could be inaccurately converted to numeric, due to select_div_scale()
deciding it didn't need to compute any fractional digits.  Force
its hand by setting the dscale of one division input to equal the
number of fractional digits we need.

In passing, rearrange the logic to not do useless work in locales
where money values are considered integral.

Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fa854112fc3d5fae1da071bd647eb777eb584c2e

Modified Files
--------------
src/backend/utils/adt/cash.c        | 58 ++++++++++++++++++++++++-------------
src/test/regress/expected/money.out | 16 +++++++++-
src/test/regress/sql/money.sql      |  6 +++-
3 files changed, 58 insertions(+), 22 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix loss of fractional digits for large values in cash_numeric()
@ 2019-07-26 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-07-26 16:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix loss of fractional digits for large values in cash_numeric().

Money values exceeding about 18 digits (depending on lc_monetary)
could be inaccurately converted to numeric, due to select_div_scale()
deciding it didn't need to compute any fractional digits.  Force
its hand by setting the dscale of one division input to equal the
number of fractional digits we need.

In passing, rearrange the logic to not do useless work in locales
where money values are considered integral.

Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/30bed9f63823a13cd3fe5b1361b7f30f7123c003

Modified Files
--------------
src/backend/utils/adt/cash.c        | 58 ++++++++++++++++++++++++-------------
src/test/regress/expected/money.out | 41 +++++++++++++++++++++++++-
src/test/regress/sql/money.sql      | 12 +++++++-
3 files changed, 89 insertions(+), 22 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix loss of fractional digits for large values in cash_numeric()
@ 2019-07-26 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-07-26 16:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix loss of fractional digits for large values in cash_numeric().

Money values exceeding about 18 digits (depending on lc_monetary)
could be inaccurately converted to numeric, due to select_div_scale()
deciding it didn't need to compute any fractional digits.  Force
its hand by setting the dscale of one division input to equal the
number of fractional digits we need.

In passing, rearrange the logic to not do useless work in locales
where money values are considered integral.

Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/81b29c87114cdcc2ff1a9247124c59d94d20a237

Modified Files
--------------
src/backend/utils/adt/cash.c        | 58 ++++++++++++++++++++++++-------------
src/test/regress/expected/money.out | 41 +++++++++++++++++++++++++-
src/test/regress/sql/money.sql      | 12 +++++++-
3 files changed, 89 insertions(+), 22 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix loss of fractional digits for large values in cash_numeric()
@ 2019-07-26 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-07-26 16:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix loss of fractional digits for large values in cash_numeric().

Money values exceeding about 18 digits (depending on lc_monetary)
could be inaccurately converted to numeric, due to select_div_scale()
deciding it didn't need to compute any fractional digits.  Force
its hand by setting the dscale of one division input to equal the
number of fractional digits we need.

In passing, rearrange the logic to not do useless work in locales
where money values are considered integral.

Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b9d2c5c7ac800bf20ea6cd4c556b6b3305863a8e

Modified Files
--------------
src/backend/utils/adt/cash.c        | 56 ++++++++++++++++++++++++-------------
src/test/regress/expected/money.out | 16 ++++++++++-
src/test/regress/sql/money.sql      |  6 +++-
3 files changed, 57 insertions(+), 21 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* pgsql: Fix loss of fractional digits for large values in cash_numeric()
@ 2019-07-26 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2019-07-26 16:00 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix loss of fractional digits for large values in cash_numeric().

Money values exceeding about 18 digits (depending on lc_monetary)
could be inaccurately converted to numeric, due to select_div_scale()
deciding it didn't need to compute any fractional digits.  Force
its hand by setting the dscale of one division input to equal the
number of fractional digits we need.

In passing, rearrange the logic to not do useless work in locales
where money values are considered integral.

Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ca918f99aaa5fe108248ea2380f637bab09a88c2

Modified Files
--------------
src/backend/utils/adt/cash.c        | 56 ++++++++++++++++++++++++-------------
src/test/regress/expected/money.out | 16 ++++++++++-
src/test/regress/sql/money.sql      |  6 +++-
3 files changed, 57 insertions(+), 21 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2019-07-26 16:00 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-26 16:00 pgsql: Fix loss of fractional digits for large values in cash_numeric() Tom Lane <tgl@sss.pgh.pa.us>
2019-07-26 16:00 pgsql: Fix loss of fractional digits for large values in cash_numeric() Tom Lane <tgl@sss.pgh.pa.us>
2019-07-26 16:00 pgsql: Fix loss of fractional digits for large values in cash_numeric() Tom Lane <tgl@sss.pgh.pa.us>
2019-07-26 16:00 pgsql: Fix loss of fractional digits for large values in cash_numeric() Tom Lane <tgl@sss.pgh.pa.us>
2019-07-26 16:00 pgsql: Fix loss of fractional digits for large values in cash_numeric() Tom Lane <tgl@sss.pgh.pa.us>
2019-07-26 16:00 pgsql: Fix loss of fractional digits for large values in cash_numeric() Tom Lane <tgl@sss.pgh.pa.us>
2019-07-26 16:00 pgsql: Fix loss of fractional digits for large values in cash_numeric() Tom Lane <tgl@sss.pgh.pa.us>

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