pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix incorrect return value for pg_size_pretty(bigint) 4+ messages / 1 participants [nested] [flat]
* pgsql: Fix incorrect return value for pg_size_pretty(bigint) @ 2024-07-28 10:23 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: David Rowley @ 2024-07-28 10:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix incorrect return value for pg_size_pretty(bigint) pg_size_pretty(bigint) would return the value in bytes rather than PB for the smallest-most bigint value. This happened due to an incorrect assumption that the absolute value of -9223372036854775808 could be stored inside a signed 64-bit type. Here we fix that by instead storing that value in an unsigned 64-bit type. This bug does exist in versions prior to 15 but the code there is sufficiently different and the bug seems sufficiently non-critical that it does not seem worth risking backpatching further. Author: Joseph Koshakow <koshy44@gmail.com> Discussion: https://postgr.es/m/CAAvxfHdTsMZPWEHUrZ=h3cky9Ccc3Mtx2whUHygY+ABP-mCmUw@mail.gmail.com Backpatch-through: 15 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b181062aa5727a013c96b64476f884c992b5068d Modified Files -------------- src/backend/utils/adt/dbsize.c | 8 ++++++-- src/test/regress/expected/dbsize.out | 8 ++++++++ src/test/regress/sql/dbsize.sql | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix incorrect return value for pg_size_pretty(bigint) @ 2024-07-28 10:23 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: David Rowley @ 2024-07-28 10:23 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix incorrect return value for pg_size_pretty(bigint) pg_size_pretty(bigint) would return the value in bytes rather than PB for the smallest-most bigint value. This happened due to an incorrect assumption that the absolute value of -9223372036854775808 could be stored inside a signed 64-bit type. Here we fix that by instead storing that value in an unsigned 64-bit type. This bug does exist in versions prior to 15 but the code there is sufficiently different and the bug seems sufficiently non-critical that it does not seem worth risking backpatching further. Author: Joseph Koshakow <koshy44@gmail.com> Discussion: https://postgr.es/m/CAAvxfHdTsMZPWEHUrZ=h3cky9Ccc3Mtx2whUHygY+ABP-mCmUw@mail.gmail.com Backpatch-through: 15 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1e020258e53c87c697615390c42a191344bbb909 Modified Files -------------- src/backend/utils/adt/dbsize.c | 8 ++++++-- src/test/regress/expected/dbsize.out | 8 ++++++++ src/test/regress/sql/dbsize.sql | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix incorrect return value for pg_size_pretty(bigint) @ 2024-07-28 10:24 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: David Rowley @ 2024-07-28 10:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix incorrect return value for pg_size_pretty(bigint) pg_size_pretty(bigint) would return the value in bytes rather than PB for the smallest-most bigint value. This happened due to an incorrect assumption that the absolute value of -9223372036854775808 could be stored inside a signed 64-bit type. Here we fix that by instead storing that value in an unsigned 64-bit type. This bug does exist in versions prior to 15 but the code there is sufficiently different and the bug seems sufficiently non-critical that it does not seem worth risking backpatching further. Author: Joseph Koshakow <koshy44@gmail.com> Discussion: https://postgr.es/m/CAAvxfHdTsMZPWEHUrZ=h3cky9Ccc3Mtx2whUHygY+ABP-mCmUw@mail.gmail.com Backpatch-through: 15 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6f6b0f193db4f850a94aeabf363bf03bd0642e60 Modified Files -------------- src/backend/utils/adt/dbsize.c | 8 ++++++-- src/test/regress/expected/dbsize.out | 8 ++++++++ src/test/regress/sql/dbsize.sql | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Fix incorrect return value for pg_size_pretty(bigint) @ 2024-07-28 10:24 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 4+ messages in thread From: David Rowley @ 2024-07-28 10:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix incorrect return value for pg_size_pretty(bigint) pg_size_pretty(bigint) would return the value in bytes rather than PB for the smallest-most bigint value. This happened due to an incorrect assumption that the absolute value of -9223372036854775808 could be stored inside a signed 64-bit type. Here we fix that by instead storing that value in an unsigned 64-bit type. This bug does exist in versions prior to 15 but the code there is sufficiently different and the bug seems sufficiently non-critical that it does not seem worth risking backpatching further. Author: Joseph Koshakow <koshy44@gmail.com> Discussion: https://postgr.es/m/CAAvxfHdTsMZPWEHUrZ=h3cky9Ccc3Mtx2whUHygY+ABP-mCmUw@mail.gmail.com Backpatch-through: 15 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0a80e88d902d3dfdeed03ede1880b8994a8d892b Modified Files -------------- src/backend/utils/adt/dbsize.c | 8 ++++++-- src/test/regress/expected/dbsize.out | 8 ++++++++ src/test/regress/sql/dbsize.sql | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-07-28 10:24 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-07-28 10:23 pgsql: Fix incorrect return value for pg_size_pretty(bigint) David Rowley <drowley@postgresql.org> 2024-07-28 10:23 pgsql: Fix incorrect return value for pg_size_pretty(bigint) David Rowley <drowley@postgresql.org> 2024-07-28 10:24 pgsql: Fix incorrect return value for pg_size_pretty(bigint) David Rowley <drowley@postgresql.org> 2024-07-28 10:24 pgsql: Fix incorrect return value for pg_size_pretty(bigint) David Rowley <drowley@postgresql.org>
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