Shared Sequences?

Started by Duncover 21 years ago5 messagesgeneral
Jump to latest
#1Dunc
postgresql@dunc-it.com

Is there any way, with PG 8 rc 3, to share a sequence across databases -
assuming all databases are on the same machine? Thanks,

Dunc

#2Andreas Kretschmer
andreas_kretschmer@despammed.com
In reply to: Dunc (#1)
Re: Shared Sequences?

begin "C. Duncan Hudson" <postgresql@dunc-it.com> wrote:

Is there any way, with PG 8 rc 3, to share a sequence across databases -
assuming all databases are on the same machine? Thanks,

Possibly via contrib/dblink, also on ealier versions.
I'm not sure about sequences, but with tables this is possible.

end
Andreas
--
Diese Message wurde erstellt mit freundlicher Unterst�tzung eines freilau-
fenden Pinguins aus artgerechter Freilandhaltung. Er ist garantiert frei
von Micro$oft'schen Viren. (#97922 http://counter.li.org) GPG 7F4584DA
Was, Sie wissen nicht, wo Kaufbach ist? Hier: N 51.05082�, E 13.56889� ;-)

#3Michael Fuhr
mike@fuhr.org
In reply to: Dunc (#1)
Re: Shared Sequences?

On Sun, Jan 02, 2005 at 10:44:16AM -0500, C. Duncan Hudson wrote:

Is there any way, with PG 8 rc 3, to share a sequence across databases -
assuming all databases are on the same machine?

As Andreas Kretschmer mentioned, you might be able to use dblink.

Why do you want to share a sequence across databases? Could you
use separate schemas in one database instead of separate databases?

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

#4Dunc
postgresql@dunc-it.com
In reply to: Michael Fuhr (#3)
Re: Shared Sequences?

Michael Fuhr wrote:

On Sun, Jan 02, 2005 at 10:44:16AM -0500, C. Duncan Hudson wrote:

Is there any way, with PG 8 rc 3, to share a sequence across databases -
assuming all databases are on the same machine?

As Andreas Kretschmer mentioned, you might be able to use dblink.

Why do you want to share a sequence across databases? Could you
use separate schemas in one database instead of separate databases?

Unfortunately, the app that I'm using doesn't yet support schemas -
otherwise I'd be doing that. I have 3 instances of the application
(each for a different business unit) and I don't want them generating
the same numbers for different things. I want the numbers, across all
business units, to be truly chronological - so I'd like them to share
the same sequence.

Dunc

#5Ragnar Hafstað
gnari@simnet.is
In reply to: Dunc (#4)
Re: Shared Sequences?

On Sun, 2005-01-02 at 16:19 -0500, C. Duncan Hudson wrote:

[about databases sharing a sequence]

I have 3 instances of the application
(each for a different business unit) and I don't want them generating
the same numbers for different things. I want the numbers, across all
business units, to be truly chronological - so I'd like them to share
the same sequence.

do you realize that sequences are not garanteed to be "chronological"?

gnari