pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel \"bodom_lx\" Graziotin <daniel.graziotin@gmail.com>
To: pgsql-sql@postgresql.org
Subject: How to have a unique primary key on two tables
Date: Thu, 22 Nov 2007 12:01:59 +0100
Message-ID: <99d8c2310711220301p57c9b7c5i4620a7e658d13b7d@mail.gmail.com> (raw)

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



view thread (4+ messages)  latest in thread

Message-ID: <99d8c2310711220301p57c9b7c5i4620a7e658d13b7d@mail.gmail.com>
Permalink:  ../99d8c2310711220301p57c9b7c5i4620a7e658d13b7d@mail.gmail.com/
Also on:    postgresql.org/message-id/99d8c2310711220301p57c9b7c5i4620a7e658d13b7d@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: daniel.graziotin@gmail.com
  Subject: Re: How to have a unique primary key on two tables
  In-Reply-To: <99d8c2310711220301p57c9b7c5i4620a7e658d13b7d@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox