From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Justin Hawkins <justin(at)internode(dot)com(dot)au> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: OID order = INSERT order? |
Date: | 2002-09-16 14:33:12 |
Message-ID: | 20020917003312.B17195@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)svana(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-09-16 14:43:52 | Re: OID order = INSERT order? |
Previous Message | Martijn van Oosterhout | 2002-09-16 14:30:00 | Re: psql: \pset pager 'always'? |