Обсуждение: OID

Поиск
Список
Период
Сортировка

OID

От
virka prasetia
Дата:
hi i'm new in psql, and i want to know several things:
1. is it possible to use oid of a table for reference attribute in another
   table ?
2. is it possible to compare oid of a class, using comparison operator
   (like,=, etc)?

--

virka prasetia


Re: OID

От
Oliver Elphick
Дата:
On Thu, 2002-02-21 at 12:29, virka prasetia wrote:
>
> hi i'm new in psql, and i want to know several things:
> 1. is it possible to use oid of a table for reference attribute in another
>    table ?

It is possible, but it is a bad design.  Oids are not preserved in a
dump, unless that is specifically requested.  They might even go away
altogether, since they are an internal feature, not part of your schema.

If you need a key field, create one; use the SERIAL datatype to get a
unique number.

> 2. is it possible to compare oid of a class, using comparison operator
>    (like,=, etc)?

I don't know what you mean by this.

Oids are arbitrary numbers consecutively assigned.  You can use "oid =
xxx" to identify a row, but no other comparison is meaningful.  You
can't even use "oid > xxx" to identify rows added later, since oids will
wrap round at the end of their range.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "My sheep hear my voice, and I know them, and they
      follow me; And I give unto them eternal life; and they
      shall never perish, neither shall any man pluck them
      out of my hand."          John 10:27,28