diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 8cd10ab204..6893c1ce09 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -3145,7 +3145,7 @@ DecodeNumberField(int len, char *str, int fmask, * Return 0 if okay (and set *tzp), a DTERR code if not okay. */ int -DecodeTimezone(char *str, int *tzp) +DecodeTimezone(const char *str, int *tzp) { int tz; int hr, @@ -3223,7 +3223,7 @@ DecodeTimezone(char *str, int *tzp) * will be related in format. */ int -DecodeTimezoneAbbrev(int field, char *lowtoken, +DecodeTimezoneAbbrev(int field, const char *lowtoken, int *offset, pg_tz **tz) { int type; @@ -3278,7 +3278,7 @@ DecodeTimezoneAbbrev(int field, char *lowtoken, * will be related in format. */ int -DecodeSpecial(int field, char *lowtoken, int *val) +DecodeSpecial(int field, const char *lowtoken, int *val) { int type; const datetkn *tp; @@ -3985,7 +3985,7 @@ DecodeISO8601Interval(char *str, * will be related in format. */ int -DecodeUnits(int field, char *lowtoken, int *val) +DecodeUnits(int field, const char *lowtoken, int *val) { int type; const datetkn *tp; diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 26f498b5df..311c9e748b 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -4246,7 +4246,7 @@ to_timestamp(PG_FUNCTION_ARGS) /* Use the specified time zone, if any. */ if (tm.tm_zone) { - int dterr = DecodeTimezone(unconstify(char *, tm.tm_zone), &tz); + int dterr = DecodeTimezone(tm.tm_zone, &tz); if (dterr) DateTimeParseError(dterr, text_to_cstring(date_txt), "timestamptz"); @@ -4343,7 +4343,7 @@ parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict, if (tm.tm_zone) { - int dterr = DecodeTimezone(unconstify(char *, tm.tm_zone), tz); + int dterr = DecodeTimezone(tm.tm_zone, tz); if (dterr) DateTimeParseError(dterr, text_to_cstring(date_txt), "timestamptz"); @@ -4429,7 +4429,7 @@ parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict, if (tm.tm_zone) { - int dterr = DecodeTimezone(unconstify(char *, tm.tm_zone), tz); + int dterr = DecodeTimezone(tm.tm_zone, tz); if (dterr) RETURN_ERROR(DateTimeParseError(dterr, text_to_cstring(date_txt), "timetz")); diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index 2cae346beb..934cb56a3a 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -296,7 +296,7 @@ extern int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, extern int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp); -extern int DecodeTimezone(char *str, int *tzp); +extern int DecodeTimezone(const char *str, int *tzp); extern int DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp); @@ -322,10 +322,10 @@ extern void EncodeSpecialTimestamp(Timestamp dt, char *str); extern int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, struct pg_tm *tm); -extern int DecodeTimezoneAbbrev(int field, char *lowtoken, +extern int DecodeTimezoneAbbrev(int field, const char *lowtoken, int *offset, pg_tz **tz); -extern int DecodeSpecial(int field, char *lowtoken, int *val); -extern int DecodeUnits(int field, char *lowtoken, int *val); +extern int DecodeSpecial(int field, const char *lowtoken, int *val); +extern int DecodeUnits(int field, const char *lowtoken, int *val); extern int j2day(int date);