Thread: REFERENCES

REFERENCES

From
Örn Hansen
Date:
Hi,

  I got the following scenario in a database.

  CREATE TABLE persons (
     id char(15),
    name varchar(80)
  );

  CREATE TABLE customer(
    discount int4
  ) INHERITS (persons);

  CREATE TABLE personal_data(
    id REFERENCES persons(id) MATCH FULL ON UPDATE CASCADE ON DELETE CASCADE,
    class char(20),
    info varchar(40)
  );

Point of it is, I want to be able to add a mobile phone number as:

INSERT INTO personal_data(id,class,info) values(ID,'MOBILE',PHONENO);

Yet still have it automatically update or deleted if the person disappears in
the database, and not stick around as a ghost.

This works ok, except that the table customer will break it.  I can't add
personal_data to a customer, even though all customer fields and data,
including the ID is in the persons database.

So my question is, is there a way to do this now, will this be possible in the
future or what is the status?

Mvh,
  Örn

Attachment