One sequence for different tables

From: Robert(dot)Farrugia(at)go(dot)com(dot)mt
To: pgsql-admin(at)postgresql(dot)org
Subject: One sequence for different tables
Date: 2002-03-11 14:20:35
Message-ID: 20020311142129.6DEB54759B1@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

Is it possible to create one sequence to be used for more than one table ?
Let's say I create a pkey_seq sequence.
Can I use it in table A (pkey default nextval('pkey_seq') PRIMARY KEY) and
in table B as (pkey default nextval('pkey_seq') PRIMARY KEY) ?
Is it safe in that each table will have unique values i.e. if I have a
third table C which is used to link data both from A and B using the pkey
field, will there be records having the same pkey but from different
tables?

Thanks alot
Robert

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message A.J. Haigh C9803392 2002-03-11 14:27:07 Postgre 7.1.3 and Solaris Install Problems
Previous Message Rohan Hathiwala 2002-03-11 13:10:57 Help