Re: oid's and primary keys on insert

From: Rob Brown-Bayliss <rob(at)zoism(dot)org>
To: Andrew Sullivan <andrew(at)libertyrms(dot)info>
Cc: PostgreSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: oid's and primary keys on insert
Date: 2002-08-10 03:03:36
Message-ID: 1028948615.3625.3.camel@everglade.zoism.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> 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.

I started out that way, but thought the whole select and update thing
would get messy, like select blah from wah where site_id = 43 and
trans_id = 5345 rather than a single where pkey = 43-5345

Thats realy the only reason I didn't do that. Not realy a goot reason
at that...

--

*
* Rob Brown-Bayliss
*

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2002-08-10 03:23:54 Re: oid's and primary keys on insert
Previous Message Martijn van Oosterhout 2002-08-10 03:00:27 Re: Transactions in functions ( was Re: transactions, serial ids, and JDBC)