pgsql: Fix bugs with parsing signed hh:mm and hh:mm:ss fields in interv

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Fix bugs with parsing signed hh:mm and hh:mm:ss fields in interv
Дата
Msg-id E1SxPcP-00062G-PY@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix bugs with parsing signed hh:mm and hh:mm:ss fields in interval input.

DecodeInterval() failed to honor the "range" parameter (the special SQL
syntax for indicating which fields appear in the literal string) if the
time was signed.  This seems inappropriate, so make it work like the
not-signed case.  The inconsistency was introduced in my commit
f867339c0148381eb1d01f93ab5c79f9d10211de, which as noted in its log message
was only really focused on making SQL-compliant literals work per spec.
Including a sign here is not per spec, but if we're going to allow it
then it's reasonable to expect it to work like the not-signed case.

Also, remove bogus setting of tmask, which caused subsequent processing to
think that what had been given was a timezone and not an hh:mm(:ss) field,
thus confusing checks for redundant fields.  This seems to be an aboriginal
mistake in Lockhart's commit 2cf1642461536d0d8f3a1cf124ead0eac04eb760.

Add regression test cases to illustrate the changed behaviors.

Back-patch as far as 8.4, where support for spec-compliant interval
literals was added.

Range problem reported and diagnosed by Amit Kapila, tmask problem by me.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/bb49e3551b33a016f75095fe7388b25c332996c3

Modified Files
--------------
src/backend/utils/adt/datetime.c       |   16 ++++++++++------
src/test/regress/expected/interval.out |   28 ++++++++++++++++++++++++++++
src/test/regress/sql/interval.sql      |    5 +++++
3 files changed, 43 insertions(+), 6 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix bugs with parsing signed hh:mm and hh:mm:ss fields in interv
Следующее
От: Bruce Momjian
Дата:
Сообщение: pgsql: Reword documentation for concurrent index rebuilds to be clearer