db design question

Поиск
Список
Период
Сортировка
От Jules Alberts
Тема db design question
Дата
Msg-id 200210151404.g9FE4kTY028669@artemis.cuci.nl
обсуждение исходный текст
Ответы Re: db design question  ("Josh Berkus" <josh@agliodbs.com>)
Список 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 по дате отправления:

Предыдущее
От: "Thilo Hille"
Дата:
Сообщение: crash - kernel or postgres?
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Big Picture