Re: [GENERAL] searching oid's - Mailing list pgsql-general

From Adriaan Joubert
Subject Re: [GENERAL] searching oid's
Date
Msg-id 387ED2BA.2916CEB5@albourne.com
Whole thread Raw
In response to Re: [GENERAL] searching oid's  (admin <admin@wtbwts.com>)
List pgsql-general
admin wrote:

> Actually, I think pg_dump with the -o flag keeps oid's, therefore allowing
> me to keep referential integrity after backup.
>
> > Using oid's is not a good idea, as they don't automatically get dumped with
> > pg_dump. And once your referential integrity gets screwed up and you are
> > using oid's you are really in a mess, as you cannot change oids. Use a serial
> > field to generate a key for every row, which generates you a sequence of
> > integers. It is much better than oids at a cost of 4 bytes.

Yes oids get dumped with the -o flag. That is why I said automatically. Fact
remains that you cannot manipulate oids. Should you ever want to copy a table into
an exisiting system you would have to do a new initdb to make sure that the oids
in your table are not in use. And if anything ever gets corrupted it is much
harder to recover and fix it, as you have no control over the oid values that the
system assigns. I would definitely recommend a separate serial value, and I
believe this is also what is recommended in the postgres docs.

Adriaan


pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [GENERAL] Database synchronisation over the internet...
Next
From: Borek Lupomesky
Date:
Subject: Does patch for GROUP BY/aggr. bug exist?