Re: One sequence for different tables

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: One sequence for different tables
Дата
Msg-id 20020311165636.GA23118@wolff.to
обсуждение исходный текст
Ответ на One sequence for different tables  (Robert.Farrugia@go.com.mt)
Список pgsql-admin
On Mon, Mar 11, 2002 at 03:20:35PM +0100,
  Robert.Farrugia@go.com.mt wrote:
> 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?

The sequence values will be unique accross tables when doing things this way.

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

Предыдущее
От: Heni Lolov
Дата:
Сообщение: OIDs / noOIDs tables?
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: One sequence for different tables