Re: Calculated bigserial column in a view

Поиск
Список
Период
Сортировка
От SCassidy@overlandstorage.com
Тема Re: Calculated bigserial column in a view
Дата
Msg-id OFAB0778D3.55A9816C-ON88256FEF.006A8C5A-88256FEF.006B1199@myoverland.net
обсуждение исходный текст
Ответ на Calculated bigserial column in a view  ("Zlatko Matic" <zlatko.matic1@sb.t-com.hr>)
Список pgsql-general
If you want a unique key across several tables, can you not do something
like:

CREATE SEQUENCE detail_seq INCREMENT BY 1;

CREATE TABLE table1 (
  table1_id       INTEGER PRIMARY KEY DEFAULT nextval('detail_seq'),
  item1_name              VARCHAR(100) NOT NULL
);


CREATE TABLE table2 (
  table2_id       INTEGER PRIMARY KEY DEFAULT nextval('detail_seq'),
  item2_name              VARCHAR(100) NOT NULL
);

Then the union of both tables will contain one unique set of ids.

Assuming that is what you are trying to do, that is.

Susan




----------------------------------------------------------------------------------------------
See our award-winning line of tape and disk-based
backup & recovery solutions at http://www.overlandstorage.com
----------------------------------------------------------------------------------------------


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

Предыдущее
От: Richard_D_Levine@raytheon.com
Дата:
Сообщение: Re: UltraSPARC versus AMD
Следующее
От: Carlos Gustavo Fischer
Дата:
Сообщение: Query Designer