pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Adjust the integer overflow tests in the numeric code. 7+ messages / 1 participants [nested] [flat]
* pgsql: Adjust the integer overflow tests in the numeric code. @ 2021-08-06 20:37 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 7+ messages in thread From: Dean Rasheed @ 2021-08-06 20:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Adjust the integer overflow tests in the numeric code. Formerly, the numeric code tested whether an integer value of a larger type would fit in a smaller type by casting it to the smaller type and then testing if the reverse conversion produced the original value. That's perfectly fine, except that it caused a test failure on buildfarm animal castoroides, most likely due to a compiler bug. Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That matches existing code in other places, such as int84(), which is more widely tested, and so is less likely to go wrong. While at it, add regression tests covering the numeric-to-int8/4/2 conversions, and adjust the recently added tests to the style of 434ddfb79a (on the v11 branch) to make failures easier to diagnose. Per buildfarm via Tom Lane, reviewed by Tom Lane. Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/2642df9fac09540c761441edd9bdd0a72c62f39c Modified Files -------------- src/backend/utils/adt/numeric.c | 22 ++++++------ src/test/regress/expected/numeric.out | 65 ++++++++++++++++++++++++++++++----- src/test/regress/sql/numeric.sql | 22 +++++++++--- 3 files changed, 85 insertions(+), 24 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Adjust the integer overflow tests in the numeric code. @ 2021-08-06 20:37 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 7+ messages in thread From: Dean Rasheed @ 2021-08-06 20:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Adjust the integer overflow tests in the numeric code. Formerly, the numeric code tested whether an integer value of a larger type would fit in a smaller type by casting it to the smaller type and then testing if the reverse conversion produced the original value. That's perfectly fine, except that it caused a test failure on buildfarm animal castoroides, most likely due to a compiler bug. Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That matches existing code in other places, such as int84(), which is more widely tested, and so is less likely to go wrong. While at it, add regression tests covering the numeric-to-int8/4/2 conversions, and adjust the recently added tests to the style of 434ddfb79a (on the v11 branch) to make failures easier to diagnose. Per buildfarm via Tom Lane, reviewed by Tom Lane. Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0325565702d8fd18ba66cdeaad4d7f43744525b2 Modified Files -------------- src/backend/utils/adt/numeric.c | 22 ++++++------ src/test/regress/expected/numeric.out | 65 ++++++++++++++++++++++++++++++----- src/test/regress/sql/numeric.sql | 22 +++++++++--- 3 files changed, 85 insertions(+), 24 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Adjust the integer overflow tests in the numeric code. @ 2021-08-06 20:37 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 7+ messages in thread From: Dean Rasheed @ 2021-08-06 20:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Adjust the integer overflow tests in the numeric code. Formerly, the numeric code tested whether an integer value of a larger type would fit in a smaller type by casting it to the smaller type and then testing if the reverse conversion produced the original value. That's perfectly fine, except that it caused a test failure on buildfarm animal castoroides, most likely due to a compiler bug. Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That matches existing code in other places, such as int84(), which is more widely tested, and so is less likely to go wrong. While at it, add regression tests covering the numeric-to-int8/4/2 conversions, and adjust the recently added tests to the style of 434ddfb79a (on the v11 branch) to make failures easier to diagnose. Per buildfarm via Tom Lane, reviewed by Tom Lane. Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/da188b993450c824b03e7dca18c27e9f4c04754f Modified Files -------------- src/backend/utils/adt/numeric.c | 22 ++++++------ src/test/regress/expected/numeric.out | 65 ++++++++++++++++++++++++++++++----- src/test/regress/sql/numeric.sql | 22 +++++++++--- 3 files changed, 85 insertions(+), 24 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Adjust the integer overflow tests in the numeric code. @ 2021-08-06 20:37 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 7+ messages in thread From: Dean Rasheed @ 2021-08-06 20:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Adjust the integer overflow tests in the numeric code. Formerly, the numeric code tested whether an integer value of a larger type would fit in a smaller type by casting it to the smaller type and then testing if the reverse conversion produced the original value. That's perfectly fine, except that it caused a test failure on buildfarm animal castoroides, most likely due to a compiler bug. Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That matches existing code in other places, such as int84(), which is more widely tested, and so is less likely to go wrong. While at it, add regression tests covering the numeric-to-int8/4/2 conversions, and adjust the recently added tests to the style of 434ddfb79a (on the v11 branch) to make failures easier to diagnose. Per buildfarm via Tom Lane, reviewed by Tom Lane. Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cc4420f8829ddbc852e8c98781f09401ef26031d Modified Files -------------- src/backend/utils/adt/numeric.c | 22 ++++++------ src/test/regress/expected/numeric.out | 65 ++++++++++++++++++++++++++++++----- src/test/regress/sql/numeric.sql | 22 +++++++++--- 3 files changed, 85 insertions(+), 24 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Adjust the integer overflow tests in the numeric code. @ 2021-08-06 20:37 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 7+ messages in thread From: Dean Rasheed @ 2021-08-06 20:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Adjust the integer overflow tests in the numeric code. Formerly, the numeric code tested whether an integer value of a larger type would fit in a smaller type by casting it to the smaller type and then testing if the reverse conversion produced the original value. That's perfectly fine, except that it caused a test failure on buildfarm animal castoroides, most likely due to a compiler bug. Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That matches existing code in other places, such as int84(), which is more widely tested, and so is less likely to go wrong. While at it, add regression tests covering the numeric-to-int8/4/2 conversions, and adjust the recently added tests to the style of 434ddfb79a (on the v11 branch) to make failures easier to diagnose. Per buildfarm via Tom Lane, reviewed by Tom Lane. Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7a9c9acfe5de25126f20720d31c8b066ac7c8588 Modified Files -------------- src/backend/utils/adt/numeric.c | 26 ++++++---------- src/test/regress/expected/numeric.out | 57 ++++++++++++++++++++++++++++++++--- src/test/regress/sql/numeric.sql | 18 +++++++++-- 3 files changed, 78 insertions(+), 23 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Adjust the integer overflow tests in the numeric code. @ 2021-08-06 20:37 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 7+ messages in thread From: Dean Rasheed @ 2021-08-06 20:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Adjust the integer overflow tests in the numeric code. Formerly, the numeric code tested whether an integer value of a larger type would fit in a smaller type by casting it to the smaller type and then testing if the reverse conversion produced the original value. That's perfectly fine, except that it caused a test failure on buildfarm animal castoroides, most likely due to a compiler bug. Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That matches existing code in other places, such as int84(), which is more widely tested, and so is less likely to go wrong. While at it, add regression tests covering the numeric-to-int8/4/2 conversions, and adjust the recently added tests to the style of 434ddfb79a (on the v11 branch) to make failures easier to diagnose. Per buildfarm via Tom Lane, reviewed by Tom Lane. Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f20b6bc96b78d50b597e28a22f58bb9240f948f9 Modified Files -------------- src/backend/utils/adt/numeric.c | 26 +++++--------- src/test/regress/expected/numeric.out | 65 ++++++++++++++++++++++++++++++----- src/test/regress/sql/numeric.sql | 22 +++++++++--- 3 files changed, 84 insertions(+), 29 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Adjust the integer overflow tests in the numeric code. @ 2021-08-06 20:37 Dean Rasheed <dean.a.rasheed@gmail.com> 0 siblings, 0 replies; 7+ messages in thread From: Dean Rasheed @ 2021-08-06 20:37 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Adjust the integer overflow tests in the numeric code. Formerly, the numeric code tested whether an integer value of a larger type would fit in a smaller type by casting it to the smaller type and then testing if the reverse conversion produced the original value. That's perfectly fine, except that it caused a test failure on buildfarm animal castoroides, most likely due to a compiler bug. Instead, do these tests by comparing against PG_INT16/32_MIN/MAX. That matches existing code in other places, such as int84(), which is more widely tested, and so is less likely to go wrong. While at it, add regression tests covering the numeric-to-int8/4/2 conversions, and adjust the recently added tests to the style of 434ddfb79a (on the v11 branch) to make failures easier to diagnose. Per buildfarm via Tom Lane, reviewed by Tom Lane. Discussion: https://postgr.es/m/2394813.1628179479%40sss.pgh.pa.us Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/5b7b92ad74f2eeb4ac166bb45be31df95e574b3b Modified Files -------------- src/backend/utils/adt/numeric.c | 26 +++++--------- src/test/regress/expected/numeric.out | 65 ++++++++++++++++++++++++++++++----- src/test/regress/sql/numeric.sql | 22 +++++++++--- 3 files changed, 84 insertions(+), 29 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2021-08-06 20:37 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-08-06 20:37 pgsql: Adjust the integer overflow tests in the numeric code. Dean Rasheed <dean.a.rasheed@gmail.com> 2021-08-06 20:37 pgsql: Adjust the integer overflow tests in the numeric code. Dean Rasheed <dean.a.rasheed@gmail.com> 2021-08-06 20:37 pgsql: Adjust the integer overflow tests in the numeric code. Dean Rasheed <dean.a.rasheed@gmail.com> 2021-08-06 20:37 pgsql: Adjust the integer overflow tests in the numeric code. Dean Rasheed <dean.a.rasheed@gmail.com> 2021-08-06 20:37 pgsql: Adjust the integer overflow tests in the numeric code. Dean Rasheed <dean.a.rasheed@gmail.com> 2021-08-06 20:37 pgsql: Adjust the integer overflow tests in the numeric code. Dean Rasheed <dean.a.rasheed@gmail.com> 2021-08-06 20:37 pgsql: Adjust the integer overflow tests in the numeric code. Dean Rasheed <dean.a.rasheed@gmail.com>
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