[Bucardo-general] PostgreSQL/Bucardo Sequences

Adeyinka adeyinka at zuida.biz
Sun Nov 9 16:02:01 UTC 2014


Ok. Thanks.

Do I have to run this commands for each sequence? I have quite a number. Or is there a wildcard I could use.

Regards,
Ade

-----Original Message-----
From: Greg Sabino Mullane <greg at endpoint.com>
Date: Sun, 9 Nov 2014 10:47:12 
To: Michelle Sullivan<michelle at sorbs.net>
Cc: <adeyinka at zuida.biz>; bucardo-general at bucardo.org<bucardo-general at bucardo.org>
Subject: Re: [Bucardo-general] PostgreSQL/Bucardo Sequences

On Sun, Nov 09, 2014 at 04:40:28PM +0100, Michelle Sullivan wrote:
> server1> ALTER SEQUENCE myseq INCREMENT BY 3 START WITH 1;
> server2> ALTER SEQUENCE myseq INCREMENT BY 3 START WITH 2;
> server3> ALTER SEQUENCE myseq INCREMENT BY 3 START WITH 3;

In the case of already used tables, you will want to see where the 
sequences already are:

SELECT last_value FROM myseq; (repeat for the others tables).

Then choose a large, even number safely above all the existing values 
and do SQL similar to the above, but using RESTART. So if your current 
sequences are at 16341 and 16992 and 17012, you might do:

server1> ALTER SEQUENCE myseq INCREMENT BY 3 RESTART WITH 18000;
server2> ALTER SEQUENCE myseq INCREMENT BY 3 RESTART WITH 18001;
server3> ALTER SEQUENCE myseq INCREMENT BY 3 RESTART WITH 18002;

-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8



More information about the Bucardo-general mailing list