Re: Calculated bigserial column in a view

From: SCassidy(at)overlandstorage(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Calculated bigserial column in a view
Date: 2005-04-26 19:29:28
Message-ID: OFAB0778D3.55A9816C-ON88256FEF.006A8C5A-88256FEF.006B1199@myoverland.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
----------------------------------------------------------------------------------------------

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Gustavo Fischer 2005-04-26 19:35:08 Query Designer
Previous Message Richard_D_Levine 2005-04-26 19:12:19 Re: UltraSPARC versus AMD