Re: oid's and primary keys on insert

From: Rob Brown-Bayliss <rob(at)zoism(dot)org>
To: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
Cc: Elaine Lindelef <eel(at)cognitivity(dot)com>, PostgreSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: oid's and primary keys on insert
Date: 2002-08-09 21:13:46
Message-ID: 1028927625.1855.63.camel@everglade.zoism.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 2002-08-10 at 08:55, Nigel J. Andrews wrote:

> I believe you are misunderstanding the suggestion.
>
> what happens if for your table without OID you define a column called oid with
> a sequence attached? How is that different to using the OID column from a
> table with OID?

My application (will) runs on several sites, each site updating the main
site each night, and each morning getting updates from all other sites
via the main site.

So if all goes well, each morning each site will start with essentially
identical databases. Many tables in the database refer to transactions
specific to one site or another. The primary key on these tables are
inserted via a trigger, and are in the form of "location-sequence" so
that this 46-23456 represents the primary key for location 46, sequence
23456 on that machine.

I cant just use a sequence at each site otherwise I could end up with 46
identical primary keys (23456) refering to different data. I cant just
make a OID sequence on each machine as this is teh same problem, and I
only need to know the oid to retrieve the primary key from the row just
inserted, after that I don't care about it at all... And inserts are
nice enough to return teh OID of a just inserted row which is helpful.

> And in a separate message you ask how will PostgreSQL identify data if OIDs are
> removed from the system? Well doesn't the data identify the data?

Doesnt' PostgreSQL use the OID's for it's own internal use? So that
every item has a unique identifier for postgresql to play with, not
necessarily the user)

Thats what I thought but I really have know idea why or what they are
for.

--

*
* Rob Brown-Bayliss
*

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2002-08-09 21:17:09 Re: oid's and primary keys on insert
Previous Message Nigel J. Andrews 2002-08-09 21:12:42 Re: uncommited question