Re: one-to-one

From: Adrian Holovaty <postgres(at)holovaty(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: one-to-one
Date: 2003-08-21 18:32:03
Message-ID: 200308211332.03345.postgres@holovaty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Josh Berkus wrote:
> create table people (
> id SERIAL PRIMARY KEY
> name
> address ....
> );
> create table member_info (
> id INT REFERENCES people(id) PRIMARY KEY
> orientation
> officer ...
> );
> Using ID both as PK and as an FK in the member_info table creates a 1:0-1
> relationship.

What are the advantages and disadvantages of this approach over table
inheritance?

create table people (
id SERIAL PRIMARY KEY
name
address ....
);
create table members (
orientation
officer ...
) inherits people;

Adrian

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jason Hihn 2003-08-21 18:43:19 Re: one-to-one
Previous Message Josh Berkus 2003-08-21 17:01:51 Re: one-to-one