Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

How to have a unique primary key on two tables



Hi everybody,
I need to have a primary key which has to be unique on two tables.
E.g.:

CREATE TABLE first
(
  id serial NOT NULL,
  testo text,
)

CREATE TABLE second
(
  id serial NOT NULL,
  testo text,
)

When I insert some text on "first", I would like first.id = second.id
+ 1, and vice versa.
A sort of primary key in common for both tables.

Any hints?
Thank you very much
-- 
Daniel "bodom_lx" Graziotin
- http://daniel.graziotin.net
- http://daniel.graziotin.net/bodom_lx.asc - GPG public key



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group