summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2017-06-19 06:44:29 +0000
committerPavan Deolasee2017-06-19 06:44:29 +0000
commit668079ca5792a23fc0e220750bff51bb0558b4a5 (patch)
treeea9cd5bd5cfc50836c82870cc7e50231ce3f13ee
parent7b42cfb485449d2dfb2d6b15752dc945eeeea8b2 (diff)
Handle various problems with sequence handling.
PG 10 changed the way sequences are stored in the catalogs. The merge broke some of those things and this commit attempts to fix most of them. We still see some sequence related failures in the regression tests, but some of the most obvious failures are now fixed.
-rw-r--r--src/backend/commands/sequence.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 13f818a036..29704341d9 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -283,6 +283,11 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq)
process_owned_by(rel, owned_by, seq->for_identity);
seqname = GetGlobalSeqName(rel, NULL, NULL);
+ increment = seqform.seqincrement;
+ min_value = seqform.seqmin;
+ max_value = seqform.seqmax;
+ start_value = seqform.seqstart;
+ cycle = seqform.seqcycle;
heap_close(rel, NoLock);
@@ -319,7 +324,7 @@ DefineSequence(ParseState *pstate, CreateSeqStmt *seq)
increment,
min_value,
max_value,
- start_value, cycle) < 0)
+ start_value, cycle) < 0)
{
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
@@ -571,7 +576,7 @@ AlterSequence(ParseState *pstate, AlterSeqStmt *stmt)
min_value = seqform->seqmin;
max_value = seqform->seqmax;
start_value = seqform->seqstart;
- last_value = elm->last;
+ last_value = newdataform->last_value;
cycle = seqform->seqcycle;
#endif
@@ -1808,7 +1813,6 @@ init_params(ParseState *pstate, List *options, bool for_identity,
#ifdef PGXC
*is_restart = true;
#endif
- seqdataform->last_value = seqform->seqstart;
seqdataform->is_called = false;
seqdataform->log_cnt = 0;
}