Subject: no subject (file transmission)

From: Ananth Srinivasan <[email-masked]>
Date: Fri, 11 Oct 91 15:28:04 EDT

We would like clarification about three specific issues in using
Postgres. We looked at the manual rather carefully and could
not find much help there. Could you let us know if our
understanding is correct?

1. Populating the class structure

We understand that in postgres data model, it makes sense to
populate only the leaf-level sub-classes, rather than any
superclasses, because the superclass level information can always
be extracted from the sub-classes but not vice-versa. e.g. in the
following class composition structure,

create emp (name=char16, ....)
create manager (dept=..., ...) inherits (emp)
create engineer (area=..., ...) inherits (emp)

We should always populate the class "engineer",
rather than "emp" and "manager". What would happen if one employee
plays two roles, e.g. an engineer may be a manager for a while,
etc. Would this lead to redundancy and inconsistency in data?
Conceptually, this means the same object carrying two different
oid's. 

2. Inheritance of super-class data and methods by sub-class.

We encountered problems in accessing inherited data elements,
when object attributes are of composite type. The problem
arises both for appending as well as for retrieving. e.g. in the
following class composition structure

create body (color=char16, doors=int4)
create vehicle (..., body=body, ...)
create car  (......, ....) inherits (vehicle)

In the class car, how do we access the attribute  "color"? 

append car(body.color="blue", ..., ....) does not work. 
append car (color="blue",  ..., ....) does not work either.
append car (body="blue"", ...) gets accepted.  Since body is
actually a composte type, this result looks non-intuitive.
append car (..., body=("blue",4), ....) does not work either.

3. Referential integrity

In the above class composition structure, how can we ensure that
all body-values in the "car" class conform to one of the instances
in the "body" class. Can this be somehow defined at the time of
creation of classes, or is there a set of libpq functions available
to facilitate referential integrity?

Thanks.

--Ananth