Re: Problems with Binary Replication - Mailing list pgsql-general

From Michael Nolan
Subject Re: Problems with Binary Replication
Date
Msg-id CAOzAquJAr-pzCkWpsYvjHPRJw0Zuz6c2j=g9v1ym68TQacB-sA@mail.gmail.com
Whole thread Raw
In response to Re: Problems with Binary Replication  (Andreas <maps.on@gmx.net>)
List pgsql-general


On Sat, Mar 31, 2012 at 6:58 PM, Andreas <maps.on@gmx.net> wrote:


Now what could one do to prevent those sequence gaps?
There might be scenarios where it's important not to have gaps in the numbering even when one has to switch to the standby if there is a failiour on the master.
E.g. numbers of invoices need to be gapless.


Then you may need to find some other way within your application to assign invoice numbers, because sequences aren't GUARANTEED not to have gaps, especially if there is a failure of the primary server that results in a switch over to the standby server.

A transaction that is rolled back (such as due to an error) after the nextval() function has been called will not roll back the sequence value, for example.

You cannot issue a nextval() call on a standby server, because it is in read-only mode.
--
MIke Nolan

pgsql-general by date:

Previous
From: Jasen Betts
Date:
Subject: Re: loading a function from a file
Next
From: Albert
Date:
Subject: Re: PostgreSQL Trigger and rows updated