aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/sequence.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-01-23 14:00:58 -0500
committerPeter Eisentraut <peter_e@gmx.net>2017-01-23 14:00:58 -0500
commit0bc1207aeb3de951bf95a9e9899b1256216d65f5 (patch)
treed6b29dbd49dec2ec22b65f0324924843c6a9bc7d /src/backend/commands/sequence.c
parent46d482814cd4a9c474540a9c4f040ce1cd514f46 (diff)
downloadpostgresql-0bc1207aeb3de951bf95a9e9899b1256216d65f5.tar.gz
postgresql-0bc1207aeb3de951bf95a9e9899b1256216d65f5.zip
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>
Diffstat (limited to 'src/backend/commands/sequence.c')
-rw-r--r--src/backend/commands/sequence.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 36f1249ee5a..0c673f5763b 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -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;
}