diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 320496e..70efc6a 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -2802,7 +2802,7 @@ DecodeISO8601Interval(char *str, struct pg_tm * tm, fsec_t *fsec) str++; continue; } - if (!(isdigit(*str) || *str == '-' || *str == '.') ) + if (!(isdigit(*str) || *str == '-' || *str == '.')) return DTERR_BAD_FORMAT; fval = strtod(str, &newstr); @@ -2833,9 +2833,10 @@ DecodeISO8601Interval(char *str, struct pg_tm * tm, fsec_t *fsec) if (fval != 0) tm->tm_mon += (fval * 12); break; - case 'T': /* ISO 8601 5.5.4.2.2 Alternative Format / Basic */ + case 'T': /* ISO 8601 4.4.3.3 Alternative Format / Basic */ case 0: - if (numlen == 8) { + if (numlen == 8) + { tm->tm_year += val / 10000; tm->tm_mon += (val / 100) % 100; tm->tm_mday += val % 100; @@ -2845,7 +2846,7 @@ DecodeISO8601Interval(char *str, struct pg_tm * tm, fsec_t *fsec) return 0; break; } /* Else fall through to extended alternative format */ - case '-': /* ISO 8601 5.5.4.2.2 Alternative Format, Extended */ + case '-': /* ISO 8601 4.4.3.3 Alternative Format, Extended */ tm->tm_year += val; tm->tm_mon += (fval * 12); if (unit == 0) @@ -2891,15 +2892,16 @@ DecodeISO8601Interval(char *str, struct pg_tm * tm, fsec_t *fsec) tm->tm_hour += val; AdjustFractionalSeconds(fval, tm, fsec, SECS_PER_HOUR); break; - case 0: /* ISO 8601 5.5.4.2.2 Alternative Format */ - if (numlen == 6) { + case 0: /* ISO 8601 4.4.3.3 Alternative Format */ + if (numlen == 6) + { tm->tm_hour += val / 10000; tm->tm_min += (val / 100) % 100; tm->tm_sec += val % 100; AdjustFractionalSeconds(fval, tm, fsec, 1); return 0; } /* Else fall through to extended alternative format */ - case ':': /* ISO 8601 5.5.4.2.2 Alternative Format, Extended */ + case ':': /* ISO 8601 4.4.3.3 Alternative Format, Extended */ tm->tm_hour += val; AdjustFractionalSeconds(fval, tm, fsec, SECS_PER_HOUR); if (unit == 0)