pgsql: Detect more overflows in timestamp[tz]_pl_interval.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Detect more overflows in timestamp[tz]_pl_interval.
Дата
Msg-id E1s18Xj-000UbQ-BN@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Detect more overflows in timestamp[tz]_pl_interval.

In commit 25cd2d640 I (tgl) opined that "The additions of the months
and microseconds fields could also overflow, of course.  However,
I believe we need no additional checks there; the existing range
checks should catch such cases".  This is demonstrably wrong however
for the microseconds field, and given that discovery it seems prudent
to be paranoid about the months addition as well.

Report and patch by Joseph Koshakow.  As before, back-patch to all
supported branches.  (However, the test case doesn't work before
v15 because we didn't allow wider-than-int32 numbers in interval
literals.  A variant test could probably be built that fits within
that restriction, but it didn't seem worth the trouble.)

Discussion: https://postgr.es/m/CAAvxfHf77sRHKoEzUw9_cMYSpbpNS2C+J_+8Dq4+0oi8iKopeA@mail.gmail.com

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/utils/adt/timestamp.c      | 20 ++++++++++++++++----
src/test/regress/expected/horology.out |  4 ++++
src/test/regress/sql/horology.sql      |  2 ++
3 files changed, 22 insertions(+), 4 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: pgsql: Fix duplicated consecutive words in comments
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Throw a more on-point error for functions depending on columns.