Hi,

I have The following situation:

CREATE TABLE data1 (
   id SERIAL PRIMARY KEY,
   data INTEGER
);

CREATE TABLE data2 (
   id SERIAL PRIMARY KEY,
   data INTEGER
);

CREATE TABLE data3 (
   id SERIAL PRIMARY KEY,
   data INTEGER
);

CREATE TABLE relations (
   id SERIAL PRIMARY KEY,
   data1 INTEGER REFERENCES data1,
   data2 INTEGER REFERENCES data2,
   data3 INTEGER REFERENCES data3
);

When I delete a record of the table realtions I also want to delete the record on the data-tables if there is no other record referencing them. How can I do this?

Regards

Andreas Fromm


---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to