Re: OID order = INSERT order? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: OID order = INSERT order?
Date
Msg-id 20020917003312.B17195@svana.org
Whole thread Raw
In response to OID order = INSERT order?  (Justin Hawkins <justin@internode.com.au>)
List pgsql-general
On Fri, Sep 13, 2002 at 10:33:33AM +0930, Justin Hawkins wrote:
>
> Hi folks,
>
> I am converting a legacy (DBM file backend) app to SQL. The current
> storage scheme utlizes ordered list values on objects. To emulate this
> I'm just doing multiple INSERTs on a table.
>
> I need to make sure they will come back out in the same order, every
> time though.
>
> When I fetch values back from the table, if I 'ORDER BY oid', will I
> always get them back in the same order I put them in?
>
> This is happening inside a transaction, if it matters.

Usually yes. In general no. The OID may wrap so than later inserts will
appear before earlier inserts. Not to mention that OIDs will soon be
optional on tables.

If you want to guarentee order, create a serial column and use that.

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

pgsql-general by date:

Previous
From: "Williams, Travis L, NPONS"
Date:
Subject: Re: Can't run configure
Next
From: Tom Lane
Date:
Subject: Re: OID order = INSERT order?