diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index e3f9f6d53d..d22d767d2f 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -1460,9 +1460,9 @@ init_params(ParseState *pstate, List *options, bool for_identity, seqdataform->log_cnt = 0; } + /* Validate maximum value. No need to check INT8 as seqmax is an int64 */ if ((seqform->seqtypid == INT2OID && (seqform->seqmax < PG_INT16_MIN || seqform->seqmax > PG_INT16_MAX)) - || (seqform->seqtypid == INT4OID && (seqform->seqmax < PG_INT32_MIN || seqform->seqmax > PG_INT32_MAX)) - || (seqform->seqtypid == INT8OID && (seqform->seqmax < PG_INT64_MIN || seqform->seqmax > PG_INT64_MAX))) + || (seqform->seqtypid == INT4OID && (seqform->seqmax < PG_INT32_MIN || seqform->seqmax > PG_INT32_MAX))) { char bufx[100]; @@ -1497,9 +1497,9 @@ init_params(ParseState *pstate, List *options, bool for_identity, seqdataform->log_cnt = 0; } + /* Validate minimum value. No need to check INT8 as seqmin is an int64 */ if ((seqform->seqtypid == INT2OID && (seqform->seqmin < PG_INT16_MIN || seqform->seqmin > PG_INT16_MAX)) - || (seqform->seqtypid == INT4OID && (seqform->seqmin < PG_INT32_MIN || seqform->seqmin > PG_INT32_MAX)) - || (seqform->seqtypid == INT8OID && (seqform->seqmin < PG_INT64_MIN || seqform->seqmin > PG_INT64_MAX))) + || (seqform->seqtypid == INT4OID && (seqform->seqmin < PG_INT32_MIN || seqform->seqmin > PG_INT32_MAX))) { char bufm[100];