Transactions and insertion ordering - Mailing list pgsql-general

From James Pharaoh
Subject Transactions and insertion ordering
Date
Msg-id 1086856130.6365.4.camel@styx.phsys.co.uk
Whole thread Raw
Responses Re: Transactions and insertion ordering  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
Hi,

I'm trying to work out how to make sure things are read from a table in
a consistent order. The table represents a queue of items and also the
history of those items.

Even with "serializable" transaction isolation I can begin two
transactions, insert a record in each, commit the second transaction
first. This second record is now visible and can be read from the queue.
But when I commit the first this one appears before the second one. This
could then be read from the queue second but when I rescan the table to
view history it looks like it was read first.

Are there any ways to make this work a little more intuitively?
Basically I guess I want to be able to model a queue effectively.

James


pgsql-general by date:

Previous
From: Holger Klawitter
Date:
Subject: Re: How to tell when postmaster is ready
Next
From: Richard Huxton
Date:
Subject: Re: How to tell when postmaster is ready