0

I'm using EDB Replication server to have 3 postgres 14 databases in sync (MMR Replication). I'm using Table Trigger as changeset logging It's working fine for the most part, but I have a problem with Sequences. Although the table rows change properly, the sequence is not updated on replicated tables. I can update the Sequences manually, I use this code:

SELECT SETVAL(
    (SELECT PG_GET_SERIAL_SEQUENCE('"table"', 'id')),
    (SELECT (MAX("id") + 1) FROM "table"),
    FALSE);

and it all works fine after that, but it's a real hassle to run that code every time there is an addition on the database. And for each table affected. Is there a way to update the Sequence during replication automatically?

Machines are all using Windows 10

1 Answer 1

0

This is working as designed. In a multi-master replication setting sequences can be (and normally are) updated independently on each write node. To avoid conflicts consider using multimaster-ready sequences or other techniques described in the documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.