Re: oid's and primary keys on insert

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: oid's and primary keys on insert
Дата
Msg-id 3D54874A.8000100@joeconway.com
обсуждение исходный текст
Ответ на Re: oid's and primary keys on insert  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Ответы Re: oid's and primary keys on insert  (Rob Brown-Bayliss <rob@zoism.org>)
Re: oid's and primary keys on insert  (Andrew Sullivan <andrew@libertyrms.info>)
Список pgsql-general
Rob Brown-Bayliss wrote:
>>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...
>

I had the exact same experience. Having a 2 column primary key on every
table (and hence for every foreign key as well) gets unmanageable pretty
quickly.

Joe


В списке pgsql-general по дате отправления:

Предыдущее
От: Rob Brown-Bayliss
Дата:
Сообщение: Re: oid's and primary keys on insert
Следующее
От: Rob Brown-Bayliss
Дата:
Сообщение: Re: oid's and primary keys on insert