Re: OID order = INSERT order?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: OID order = INSERT order?
Дата
Msg-id 20020917003312.B17195@svana.org
обсуждение исходный текст
Ответ на OID order = INSERT order?  (Justin Hawkins <justin@internode.com.au>)
Список 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 по дате отправления:

Предыдущее
От: "Williams, Travis L, NPONS"
Дата:
Сообщение: Re: Can't run configure
Следующее
От: Tom Lane
Дата:
Сообщение: Re: OID order = INSERT order?