Re: Unique value over different servers

From: Einar Karttunen <ekarttun(at)cs(dot)Helsinki(dot)FI>
To: Per-Olof Pettersson <pgsql(at)peope(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Unique value over different servers
Date: 2001-05-28 11:13:10
Message-ID: Pine.LNX.4.30.0105281407001.23524-100000@melkinpaasi.cs.Helsinki.FI
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 28 May 2001, Per-Olof Pettersson wrote:

> I have two databases on two different servers.
>
> I'd like to make a field that will be unique on both servers.
>
> Is this possible. How do I accompish that. Is oid a good value to use?
> Is there a function for it?
>
oid is not the way to do it. Currently there is IMHO no easy and good way
to implement it. If you don't mind using a very non-portable and bad way
of doing it you could for example create the following sequences:
in db1:
CREATE SEQUENCE unique_values_in_both_dbs INCREMENT 2 MINVALUE 1;
in db2:
CREATE SEQUENCE unique_values_in_both_dbs INCREMENT 2 MINVALUE 2;

But this not not a solution you should use if you have an alternative

Einar Karttunen

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kapil Tilwani 2001-05-28 11:26:37
Previous Message Nils Zonneveld 2001-05-28 09:50:14 Re: Stored Procedure