Re: OID as Primary Key - Mailing list pgsql-general

From Karl DeBisschop
Subject Re: OID as Primary Key
Date
Msg-id 3ABA1EEC.42C74619@alert.infoplease.com
Whole thread Raw
In response to Re: Re: OID as Primary Key  (Jonas Bengtsson <jonas.b@home.se>)
List pgsql-general
Jonas Bengtsson wrote:
>
> Can't you do a dump with the oid's?
>
> But when I want to know the primary key of the inserted row
> I have to do an extra select query. If I use oid I just use
> pg_getlastoid() in php.
> And it is redundant data to store another integer.
>
> Comments?

I have often used OID as primary key, usually for the reason's you cite.
IMHO, in the long run, the two major extra worries are often not worth
it:

1) You must explicitly dump and restore OIDs all the time
2) You loose generic SQL compatibility

On the other hand, we've never had a failure from theses causes. In
short, using OIDs seems to work well enough for us, but the downsides in
practice have been larger than we expected, and the upsides smaller. In
our case, the extra serial would be a small part of the overall data, so
I kind of wish I had not used OIDs.

Just my $0.02 worth.

--
Karl

pgsql-general by date:

Previous
From: Björn Lundin
Date:
Subject: Re: Database shutdown
Next
From: Loïc Courtois
Date:
Subject: