Move the update of cached "increment" value.
authorHeikki Linnakangas <[email protected]>
Mon, 20 Apr 2015 12:58:41 +0000 (15:58 +0300)
committerHeikki Linnakangas <[email protected]>
Mon, 20 Apr 2015 12:59:33 +0000 (15:59 +0300)
It was not such a convenient place for it where it was, contrary to the
comment.

src/backend/commands/sequence.c

index 88e7b1d50a5f87fcf18e44dee05f7f7464d85b67..755df07af1bdf7df07c169858718a5e096db5774 100644 (file)
@@ -651,6 +651,7 @@ nextval_internal(Oid relid)
        elm->last = result;                     /* last returned number */
        elm->cached = last;                     /* last fetched number */
        elm->last_valid = true;
+       elm->increment = seq_form->increment_by;
 
        last_used_seq = elm;
 
@@ -975,7 +976,6 @@ sequence_read_tuple(SequenceHandle *seqh)
        Buffer          buf;
        ItemId          lp;
        sequence_magic *sm;
-       Form_pg_sequence seq_form;
 
        if (seqh->tup.t_data != NULL)
                return &seqh->tup;
@@ -1014,11 +1014,6 @@ sequence_read_tuple(SequenceHandle *seqh)
                MarkBufferDirtyHint(buf, true);
        }
 
-       seq_form = (Form_pg_sequence) GETSTRUCT(&seqh->tup);
-
-       /* this is a handy place to update our copy of the increment */
-       seqh->elm->increment = seq_form->increment_by;
-
        return &seqh->tup;
 }