jdavis-pgsql@empires.org (Jeff Davis) writes:
> Backtracking a little, I'm still wondering how exactly a replicated
> sequence is supposed to behave, do you have some comments about
> that? I don't understand exactly why it's useful.
The reason why it is is necessary to have some kind of handling of
sequences is the fact that tables commonly self-populate ID columns
using sequences.
create table important_table (
id serial unique not null,
descr text,
created_on timestamptz default now()
);
That "id" field is populated via a sequence.
If Slony1 is told to shift control of the system to a new master, it
won't be very nice if "test_id_seq" (the sequence that was generated)
is set to 0 on the slaves, when the master has populated hundreds or
thousands of rows and has used thousands of sequence values.
If "test_id_seq" _doesn't_ get set to a nice high value, then if a
slave gets promoted to master, new inserts into important_table will
use low ID values, and, more than likely, conflict sporadically. Bad
Thing.
--
select 'cbbrowne' || '@' || 'acm.org';
http://www3.sympatico.ca/cbbrowne/wp.html
Signs of a Klingon Programmer - 19. "My program has just dumped Stova
Core!"