deleting referenced data

Поиск
Список
Период
Сортировка
От Andreas Fromm
Тема deleting referenced data
Дата
Msg-id 3F4B694E.6080106@physik.uni-erlangen.de
обсуждение исходный текст
Ответы Re: deleting referenced data  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: many columns with references to one table
Следующее
От: Raymond
Дата:
Сообщение: Excel 97 Export to Postgres