1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

Fix default minimum value for descending sequences

For some reason that is lost in history, a descending sequence would
default its minimum value to -2^63+1 (-PG_INT64_MAX) instead of
-2^63 (PG_INT64_MIN), even though explicitly specifying a minimum value
of -2^63 would work.  Fix this inconsistency by using the full range by
default.

Reported-by: Daniel Verite <daniel@manitou-mail.org>
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
Peter Eisentraut
2017-01-23 14:00:58 -05:00
parent 46d482814c
commit 0bc1207aeb
4 changed files with 5 additions and 11 deletions

View File

@@ -1353,7 +1353,7 @@ init_params(ParseState *pstate, List *options, bool isInit,
else if (isInit || max_value != NULL)
{
if (seqform->seqincrement > 0)
seqform->seqmax = SEQ_MAXVALUE; /* ascending seq */
seqform->seqmax = PG_INT64_MAX; /* ascending seq */
else
seqform->seqmax = -1; /* descending seq */
seqdataform->log_cnt = 0;
@@ -1370,7 +1370,7 @@ init_params(ParseState *pstate, List *options, bool isInit,
if (seqform->seqincrement > 0)
seqform->seqmin = 1; /* ascending seq */
else
seqform->seqmin = SEQ_MINVALUE; /* descending seq */
seqform->seqmin = PG_INT64_MIN; /* descending seq */
seqdataform->log_cnt = 0;
}