Hello,
please consider the following exemplary setup:
I want to store information on people in a database. People can be
either internal (staff) or external (company contacts, etc.). The idea
was to use one table for all people and have the tables that store
specific information inherit from it.
CREATE TABLE people (
id SERIAL PRIMARY KEY,
name VARCHAR(128),
given_name VARCHAR(128),
internal BOOLEAN DEFAULT TRUE
);
CREATE TABLE internal_people (
uid VARCHAR(8),
role VARCHAR(32)
) INHERITS (people);
CREATE TABLE external_people (
company INTEGER REFERENCES companies(id)
);
What would be the best way to select a person from table people and
depending on "internal" have the information from internal_people or
external_people displayed as well?
All the best,
Hubertus
--
Hubertus von Fuerstenberg
Commercial and Technical Services / IT
Fraunhofer-Institut fuer Solare Energiesysteme ISE
Heidenhofstrasse 2, 79110 Freiburg, Germany
Phone: +49 (0) 7 61 / 45 88-0 Fax: +49 (0) 7 61 / 45 88-90 00
hubertus.fuerstenberg@xxxxxxxxxxxxxxxxx
http://www.ise.fraunhofer.de
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general