From: | Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
---|---|
To: | Alan Wayne <alanjwayne(at)yahoo(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Use of OIDS as primary keys |
Date: | 2002-05-12 10:44:04 |
Message-ID: | 20020512114404.F9305@quartz.newn.cam.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, May 11, 2002 at 11:23:05PM -0700, Alan Wayne wrote:
> Hi!
>
> I'm wondering how I can use the system generated OIDS
> as primary keys. Does postgre automatically fill in
> the system generated oid when a field of type oid is
> created as the primary key? And if so, how do I read
> it back on a record just created so I can use it as a
> secondary key in another table? And lastly, is it even
> a good idea to use the oid as keys at all when I'm
> going to eventually migrate the data from one machine
> to another?
I believe that every row in a table already has a field "oid". You can see
this if you select oid,* from yourtable; If you create another column of
type oid in your table, it's up to you to fill it in (but no need to bother,
column "oid" is already there). I wouldn't use oids as primary keys, but
rather create a column of type "serial".
Cheers,
Patrick
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-05-12 15:56:46 | Re: Serious environment problem with 7.2 on Solaris |
Previous Message | Peter Dimov | 2002-05-12 06:36:13 | Trigger performance |