db design question - Mailing list pgsql-novice

From Jules Alberts
Subject db design question
Date
Msg-id 200210151404.g9FE4kTY028669@artemis.cuci.nl
Whole thread Raw
Responses Re: db design question
List 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!

pgsql-novice by date:

Previous
From: "Thilo Hille"
Date:
Subject: crash - kernel or postgres?
Next
From: "Josh Berkus"
Date:
Subject: Re: Big Picture