From: Pavan Deolasee Date: Mon, 19 Jun 2017 06:44:29 +0000 (+0530) Subject: Handle various problems with sequence handling. X-Git-Tag: XL_10_R1BETA1~268 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=668079ca5792a23fc0e220750bff51bb0558b4a5;p=postgres-xl.git 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. --- 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; }