!3710 intervaltypmodin函数中使用unsigned int32类型存在问题

Merge pull request !3710 from ytwx1993/ytwx1993_0711_04
This commit is contained in:
opengauss_bot
2023-07-25 06:09:09 +00:00
committed by Gitee

View File

@ -1111,7 +1111,7 @@ Datum intervaltypmodin(PG_FUNCTION_ARGS)
if (n == 1) { if (n == 1) {
if (tl[0] != INTERVAL_FULL_RANGE) if (tl[0] != INTERVAL_FULL_RANGE)
typmod = INTERVAL_TYPMOD(INTERVAL_FULL_PRECISION, (unsigned int32)tl[0]); typmod = INTERVAL_TYPMOD(INTERVAL_FULL_PRECISION, (unsigned int)tl[0]);
else else
typmod = -1; typmod = -1;
} else if (n == 2) { } else if (n == 2) {
@ -1123,9 +1123,9 @@ Datum intervaltypmodin(PG_FUNCTION_ARGS)
ereport(WARNING, ereport(WARNING,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("INTERVAL(%d) precision reduced to maximum allowed, %d", tl[1], MAX_INTERVAL_PRECISION))); errmsg("INTERVAL(%d) precision reduced to maximum allowed, %d", tl[1], MAX_INTERVAL_PRECISION)));
typmod = INTERVAL_TYPMOD(MAX_INTERVAL_PRECISION, (unsigned int32)tl[0]); typmod = INTERVAL_TYPMOD(MAX_INTERVAL_PRECISION, (unsigned int)tl[0]);
} else } else
typmod = INTERVAL_TYPMOD((unsigned int32)tl[1], (unsigned int32)tl[0]); typmod = INTERVAL_TYPMOD((unsigned int)tl[1], (unsigned int)tl[0]);
} else { } else {
ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid INTERVAL type modifier"))); ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid INTERVAL type modifier")));
typmod = 0; /* keep compiler quiet */ typmod = 0; /* keep compiler quiet */