pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: vwu98034@lycos.com
To: pgsql-sql@postgresql.org
Subject: Re: Inheritance or no inheritance, there is a question
Date: Mon, 18 Aug 2003 21:36:39 -0700
Message-ID: <200308182136.39919.josh@agliodbs.com> (raw)
In-Reply-To: <GMCPCMGLPNDDCFAA@mailcity.com>
References: <GMCPCMGLPNDDCFAA@mailcity.com>

Vernon,

> What is the best solution for this DB scheme problem?

Have you considered not using inheritance?   As a relational-SQL geek myself, 
I'm not keen on inheritance -- I feel it mucks up the relational model.  Not 
everyone agrees with me, of course.

Personally, I'd suggest the following structure:

Profile A
	id Primary Key
	detail1
	detail2

Profile B
	id Primary Key references Profile A ( ID )
	detail 3
	detail 4
	detail 5

Profile Languages
	id not null references profile A ( ID )
	language id
	primary key id, language id

etc.

In this way, Profile B is a child table with a 1:0-1 relationship with Profile 
A.  Multi-value dependancies, like Languages, can be related to either the 
people who belong to the B group (and, by implication, the B group) or the 
people who belong to the A group only.

Want the B group?  SELECT A JOIN B
Want the A group only?  SELECT A EXCEPT B

This is the "relational" way to approach the problem.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (4+ messages)  latest in thread

Message-ID: <200308182136.39919.josh@agliodbs.com>
Permalink:  ../200308182136.39919.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200308182136.39919.josh@agliodbs.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: josh@agliodbs.com, vwu98034@lycos.com
  Subject: Re: Inheritance or no inheritance, there is a question
  In-Reply-To: <200308182136.39919.josh@agliodbs.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