seqform, newdataform,
&need_seq_rewrite, &owned_by);
- /* Clear local cache so that we don't think we have cached numbers */
- /* Note that we do not change the currval() state */
- elm->cached = elm->last;
-
/* If needed, rewrite the sequence relation itself */
if (need_seq_rewrite)
{
fill_seq_with_data(seqrel, newdatatuple);
}
+ /* Clear local cache so that we don't think we have cached numbers */
+ /* Note that we do not change the currval() state */
+ elm->cached = elm->last;
+
/* process OWNED BY if given */
if (owned_by)
process_owned_by(seqrel, owned_by, stmt->for_identity);
seq = read_seq_tuple(seqrel, &buf, &seqdatatuple);
page = BufferGetPage(buf);
- elm->increment = incby;
last = next = result = seq->last_value;
fetch = cache;
log = seq->log_cnt;
Assert(log >= 0);
/* save info in local cache */
+ elm->increment = incby;
elm->last = result; /* last returned number */
elm->cached = last; /* last fetched number */
elm->last_valid = true;