diff options
| author | Michael P | 2011-02-16 09:28:43 +0000 |
|---|---|---|
| committer | Pavan Deolasee | 2011-05-19 17:49:37 +0000 |
| commit | a506d83c8ae27ccc1c9cd8fb6bc0f077bf73747f (patch) | |
| tree | 4dc5ff38bd03e02324e4d1b3f4e3228862ea7936 /src/gtm | |
| parent | e08eb37ced7b0d4416a9812432ed365f54aa5a08 (diff) | |
Fix for bug 3142430
Setting a sequence with setval for non-called cases
made nextval return wrong results.
This was a bug from pg_regress.
Diffstat (limited to 'src/gtm')
| -rw-r--r-- | src/gtm/main/gtm_seq.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gtm/main/gtm_seq.c b/src/gtm/main/gtm_seq.c index 359a9598a6..570636be58 100644 --- a/src/gtm/main/gtm_seq.c +++ b/src/gtm/main/gtm_seq.c @@ -695,8 +695,12 @@ GTM_SeqSetVal(GTM_SequenceKey seqkey, GTM_Sequence nextval, bool iscalled) if (seqinfo->gs_value != nextval) seqinfo->gs_value = nextval; - if (seqinfo->gs_called != iscalled) - seqinfo->gs_called = iscalled; + + seqinfo->gs_called = iscalled; + + /* If sequence is not called, reset the init value to the value set */ + if (!iscalled) + seqinfo->gs_init_value = nextval; /* Remove the old key with the old name */ GTM_RWLockRelease(&seqinfo->gs_lock); |
