Am 31.05.2014 um 13:56 schrieb Arnt Gulbrandsen <[email protected]>:

> On Saturday, May 31, 2014 11:10:00 AM CEST, Axel Rau wrote:
>> I’m usually using primary key sequences with increment > 1 for that (1,3,5,7 
>> on primary server, 2,4,6,8 on secondary).
> 
> If you have a natural primary key, you can either declare that using SQL 
> syntax, or not. There is no middle way.
This is one of the reasons, I always use synthetic primary keys. The only 
exceptions are junction relations, which
reference existing tables and should not face your problem.
> 
> If you declare it, then you're stuck with how that key behaves. If it won’t 
> increase in pairs,
Hmm, what do you mean with that?
> then so be it.
> 
> If you don't declare it, and use a primary key sequence instead, then you 
> have the mongodb problem. Basically the same as not declaring "unique" in a 
> column that's unique in the requirements specification. Sure, you can do it 
> and it makes the RDBMS stop complaining. I hope you’re not suggesting that?
No I’m usually doing something like:

CREATE SEQUENCE mail_Id_seq INCREMENT BY 2 START WITH 2 — WITH 1 on other server
CREATE TABLE mail 
  id     int8      PRIMARY KEY                          — 'PK of mail table'
                      DEFAULT nextval('mail_Id_seq') ,
  . . .

Axel
---
PGP-Key:29E99DD6  ☀ +49 151 2300 9283  ☀ computing @ chaos claudius

Reply via email to