Re: OID - Mailing list pgsql-general

From Oliver Elphick
Subject Re: OID
Date
Msg-id 1014280223.13241.123.camel@linda
Whole thread Raw
In response to OID  (virka prasetia <virka@kmrg.lib.itb.ac.id>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: deleting an identical record
Next
From: Jean-Luc Lachance
Date:
Subject: Re: deleting an identical record