db design question

From: "Jules Alberts" <jules(dot)alberts(at)arbodienst-limburg(dot)nl>
To: pgsql-novice(at)postgresql(dot)org
Subject: db design question
Date: 2002-10-15 14:01:51
Message-ID: 200210151404.g9FE4kTY028669@artemis.cuci.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello everyone,

I'm currently designing the structure of our new pg database, and I
have a question. In our current platform, addresses are stored in
several places, like this (in semicode):

company(name varchar(100), street varchar(100), state varchar(100))
employee(code int, street varchar(100), state varchar(100))
consultant(name varchar(50), street varchar(100), state varchar(100))

The colums street and state (and a lot more in real life) are the same.
My idea for the new db was someting like this:

company(name varchar(100))
employee(code int)
consultant(name varchar(50))
address(ref_oid OID, street varchar(100), state varchar(100))

In this way, I can store all the addresses together and find them with.
SELECT * WHERE addres.ref_oid = company.oid;

Sort of the same manner as the storeage of BLOBs. Is this approach
common practice? Is it safe? I know I have to make backups with the
OIDs etc., but besides that, any more pitfalls?

TIA!

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message matt 2002-10-15 16:17:36 Webmin -postgres (Really Novice) Help
Previous Message Thilo Hille 2002-10-15 12:51:17 crash - kernel or postgres?