Re: one-to-one

Поиск
Список
Период
Сортировка
От Jason Hihn
Тема Re: one-to-one
Дата
Msg-id NGBBLHANMLKMHPDGJGAPOEHLCMAA.jhihn@paytimepayroll.com
обсуждение исходный текст
Ответ на Re: one-to-one  (Adrian Holovaty <postgres@holovaty.com>)
Список pgsql-novice
Warning: Novice answering a question. ;-)

The way he did it, you'll have two tables, a master list of people and a
table just members & their member data. The way you did it, you'll have one,
and always store all the info. Inherits just adds existing schema to the
table, IIRC.



> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Adrian Holovaty
> Sent: Thursday, August 21, 2003 2:32 PM
> To: pgsql-novice@postgresql.org
> Subject: Re: [NOVICE] one-to-one
>
>
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>


В списке pgsql-novice по дате отправления:

Предыдущее
От: Adrian Holovaty
Дата:
Сообщение: Re: one-to-one
Следующее
От: Leslie Valmadre
Дата:
Сообщение: Counting table/row access