Re: OID

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: virka prasetia <virka(at)kmrg(dot)lib(dot)itb(dot)ac(dot)id>
Cc: postgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: OID
Date: 2002-02-21 08:30:23
Message-ID: 1014280223.13241.123.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Elphick(at)lfix(dot)co(dot)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

In response to

  • OID at 2002-02-21 12:29:21 from virka prasetia

Browse pgsql-general by date

  From Date Subject
Next Message Hugo Coolens 2002-02-21 08:37:49 basis.sql and advance.sql missing
Previous Message Oliver Elphick 2002-02-21 08:25:02 Re: deleting an identical record