On Sun, Aug 21, 2016 at 11:13 PM, Craig Ringer <cr...@2ndquadrant.com> wrote: > If the sequence is created in the current xact (i.e. uncommitted) we have to > add the sequence updates to that xact to be replayed only if it commits. The > sequence is visible only to the toplevel xact that created the sequence so > advances of it can only come from that xact and its children. The actual > CREATE SEQUENCE is presumed to be handled separately by an event trigger or > similar. > > If the new sequence is committed we must replay sequence advances > immediately and non-transactionally to ensure they're not lost due to xact > rollback or replayed in the wrong order due to xact commit order.
So, I wish I could give you some better advice on this topic, but sadly I am not an expert in this area. However, it seems to me that this is just one facet of a much more general problem: given two transactions T1 and T2, the order of replay must match the order of commit unless you can prove that there are no dependencies between them. I don't see why it matters whether the operations are sequence operations or data operations; it's just a question of whether they're modifying the same "stuff". Of course, it's possible I'm missing something important here... -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers