|
|
|
@ -745,9 +745,9 @@ nextval_internal(Oid relid, bool check_permissions) |
|
|
|
|
if (!cycle) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("nextval: reached maximum value of sequence \"%s\" (%lld)", |
|
|
|
|
errmsg("nextval: reached maximum value of sequence \"%s\" (%" PRId64 ")", |
|
|
|
|
RelationGetRelationName(seqrel), |
|
|
|
|
(long long) maxv))); |
|
|
|
|
maxv))); |
|
|
|
|
next = minv; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -764,9 +764,9 @@ nextval_internal(Oid relid, bool check_permissions) |
|
|
|
|
if (!cycle) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED), |
|
|
|
|
errmsg("nextval: reached minimum value of sequence \"%s\" (%lld)", |
|
|
|
|
errmsg("nextval: reached minimum value of sequence \"%s\" (%" PRId64 ")", |
|
|
|
|
RelationGetRelationName(seqrel), |
|
|
|
|
(long long) minv))); |
|
|
|
|
minv))); |
|
|
|
|
next = maxv; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -988,9 +988,9 @@ do_setval(Oid relid, int64 next, bool iscalled) |
|
|
|
|
if ((next < minv) || (next > maxv)) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), |
|
|
|
|
errmsg("setval: value %lld is out of bounds for sequence \"%s\" (%lld..%lld)", |
|
|
|
|
(long long) next, RelationGetRelationName(seqrel), |
|
|
|
|
(long long) minv, (long long) maxv))); |
|
|
|
|
errmsg("setval: value %" PRId64 " is out of bounds for sequence \"%s\" (%" PRId64 "..%" PRId64 ")", |
|
|
|
|
next, RelationGetRelationName(seqrel), |
|
|
|
|
minv, maxv))); |
|
|
|
|
|
|
|
|
|
/* Set the currval() state only if iscalled = true */ |
|
|
|
|
if (iscalled) |
|
|
|
@ -1463,8 +1463,8 @@ init_params(ParseState *pstate, List *options, bool for_identity, |
|
|
|
|
|| (seqform->seqtypid == INT4OID && (seqform->seqmax < PG_INT32_MIN || seqform->seqmax > PG_INT32_MAX))) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("MAXVALUE (%lld) is out of range for sequence data type %s", |
|
|
|
|
(long long) seqform->seqmax, |
|
|
|
|
errmsg("MAXVALUE (%" PRId64 ") is out of range for sequence data type %s", |
|
|
|
|
seqform->seqmax, |
|
|
|
|
format_type_be(seqform->seqtypid)))); |
|
|
|
|
|
|
|
|
|
/* MINVALUE (null arg means NO MINVALUE) */ |
|
|
|
@ -1495,17 +1495,17 @@ init_params(ParseState *pstate, List *options, bool for_identity, |
|
|
|
|
|| (seqform->seqtypid == INT4OID && (seqform->seqmin < PG_INT32_MIN || seqform->seqmin > PG_INT32_MAX))) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("MINVALUE (%lld) is out of range for sequence data type %s", |
|
|
|
|
(long long) seqform->seqmin, |
|
|
|
|
errmsg("MINVALUE (%" PRId64 ") is out of range for sequence data type %s", |
|
|
|
|
seqform->seqmin, |
|
|
|
|
format_type_be(seqform->seqtypid)))); |
|
|
|
|
|
|
|
|
|
/* crosscheck min/max */ |
|
|
|
|
if (seqform->seqmin >= seqform->seqmax) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("MINVALUE (%lld) must be less than MAXVALUE (%lld)", |
|
|
|
|
(long long) seqform->seqmin, |
|
|
|
|
(long long) seqform->seqmax))); |
|
|
|
|
errmsg("MINVALUE (%" PRId64 ") must be less than MAXVALUE (%" PRId64 ")", |
|
|
|
|
seqform->seqmin, |
|
|
|
|
seqform->seqmax))); |
|
|
|
|
|
|
|
|
|
/* START WITH */ |
|
|
|
|
if (start_value != NULL) |
|
|
|
@ -1524,15 +1524,15 @@ init_params(ParseState *pstate, List *options, bool for_identity, |
|
|
|
|
if (seqform->seqstart < seqform->seqmin) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("START value (%lld) cannot be less than MINVALUE (%lld)", |
|
|
|
|
(long long) seqform->seqstart, |
|
|
|
|
(long long) seqform->seqmin))); |
|
|
|
|
errmsg("START value (%" PRId64 ") cannot be less than MINVALUE (%" PRId64 ")", |
|
|
|
|
seqform->seqstart, |
|
|
|
|
seqform->seqmin))); |
|
|
|
|
if (seqform->seqstart > seqform->seqmax) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("START value (%lld) cannot be greater than MAXVALUE (%lld)", |
|
|
|
|
(long long) seqform->seqstart, |
|
|
|
|
(long long) seqform->seqmax))); |
|
|
|
|
errmsg("START value (%" PRId64 ") cannot be greater than MAXVALUE (%" PRId64 ")", |
|
|
|
|
seqform->seqstart, |
|
|
|
|
seqform->seqmax))); |
|
|
|
|
|
|
|
|
|
/* RESTART [WITH] */ |
|
|
|
|
if (restart_value != NULL) |
|
|
|
@ -1554,15 +1554,15 @@ init_params(ParseState *pstate, List *options, bool for_identity, |
|
|
|
|
if (seqdataform->last_value < seqform->seqmin) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("RESTART value (%lld) cannot be less than MINVALUE (%lld)", |
|
|
|
|
(long long) seqdataform->last_value, |
|
|
|
|
(long long) seqform->seqmin))); |
|
|
|
|
errmsg("RESTART value (%" PRId64 ") cannot be less than MINVALUE (%" PRId64 ")", |
|
|
|
|
seqdataform->last_value, |
|
|
|
|
seqform->seqmin))); |
|
|
|
|
if (seqdataform->last_value > seqform->seqmax) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("RESTART value (%lld) cannot be greater than MAXVALUE (%lld)", |
|
|
|
|
(long long) seqdataform->last_value, |
|
|
|
|
(long long) seqform->seqmax))); |
|
|
|
|
errmsg("RESTART value (%" PRId64 ") cannot be greater than MAXVALUE (%" PRId64 ")", |
|
|
|
|
seqdataform->last_value, |
|
|
|
|
seqform->seqmax))); |
|
|
|
|
|
|
|
|
|
/* CACHE */ |
|
|
|
|
if (cache_value != NULL) |
|
|
|
@ -1571,8 +1571,8 @@ init_params(ParseState *pstate, List *options, bool for_identity, |
|
|
|
|
if (seqform->seqcache <= 0) |
|
|
|
|
ereport(ERROR, |
|
|
|
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
|
|
|
|
errmsg("CACHE (%lld) must be greater than zero", |
|
|
|
|
(long long) seqform->seqcache))); |
|
|
|
|
errmsg("CACHE (%" PRId64 ") must be greater than zero", |
|
|
|
|
seqform->seqcache))); |
|
|
|
|
seqdataform->log_cnt = 0; |
|
|
|
|
} |
|
|
|
|
else if (isInit) |
|
|
|
|