[Bucardo-general] Bucardo Master - Master replication - Are Foreign Keys maintained?

Greg Sabino Mullane greg at endpoint.com
Fri Dec 14 03:25:42 UTC 2012


On Thu, Dec 06, 2012 at 12:08:56PM +0100, Milan Boros /EvoChip/ wrote:
> The primary keys are auto increment fields, so during replication (moving
> data back to the main database) I can have the same Table1.PrimaryKey in
> both database (Server room + laptop). 

Your best solution is to offset the sequences that are making the primary 
keys, such that both count by two but one does even and one does odds.
So the master database would so something like:

ALTER SEQUENCE mypkseq INCREMENT BY 2;

Do the same thing on the remote database, but call nextval() as needed 
to make sure it is even if the master is odd, and vice versa.

> If yes, can it also take care about ForeignKey links?

Just include all the tables in the sync and you will be good.


-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20121213/a47ba609/attachment.sig>


More information about the Bucardo-general mailing list