From: | Andrew Sullivan <andrew(at)libertyrms(dot)info> |
---|---|
To: | PostgreSQL General List <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: oid's and primary keys on insert |
Date: | 2002-08-09 22:04:54 |
Message-ID: | 20020809180454.Q7239@mail.libertyrms.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Aug 10, 2002 at 09:13:46AM +1200, Rob Brown-Bayliss wrote:
> 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.
Why don't you use a sequence at each site and a "site id" field?
Then put a unique index on the site id + the sequence. You'd get
something like
|site_id|trans_id|
------------------
| 46 | 23456 |
Also makes it easier to get "all transactions from site 46". You can
even set each site's site_id field to the appropriate default, if you
want, so that you don't have to handle it in your code.
> 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)
No, every item doesn't need it. System things do. So tables are
identified by OID. But a field in a table is field n of table OIDnn.
A
--
----
Andrew Sullivan 87 Mowat Avenue
Liberty RMS Toronto, Ontario Canada
<andrew(at)libertyrms(dot)info> M6K 3E3
+1 416 646 3304 x110
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2002-08-09 22:07:31 | Re: oid's and primary keys on insert |
Previous Message | Nigel J. Andrews | 2002-08-09 22:01:30 | Re: oid's and primary keys on insert |