Re: one-to-one - Mailing list pgsql-novice

From Adrian Holovaty
Subject Re: one-to-one
Date
Msg-id 200308211332.03345.postgres@holovaty.com
Whole thread Raw
In response to Re: one-to-one  (Josh Berkus <josh@agliodbs.com>)
Responses Re: one-to-one
Re: one-to-one
List 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

pgsql-novice by date:

Previous
From: Josh Berkus
Date:
Subject: Re: one-to-one
Next
From: Jason Hihn
Date:
Subject: Re: one-to-one