Re: Question
От | Christopher Kings-Lynne |
---|---|
Тема | Re: Question |
Дата | |
Msg-id | GNELIHDDFBOCMGBFGEFOCEIHCAAA.chriskl@familyhealth.com.au обсуждение исходный текст |
Ответ на | Question (Andriy Pyrozhenko <andriy.pyrozhenko@vanjaonline.com>) |
Ответы |
Re: Question
|
Список | pgsql-sql |
Question: Why don't you just set up a foreign key that will achieve exactly the same thing without using RULEs? ie. ALTER TABLE activities ADD FOREIGN KEY (job_id) REFERENCES jobs(job_id) ON DELETE CASCADE; Chris > -----Original Message----- > From: pgsql-sql-owner@postgresql.org > [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Andriy Pyrozhenko > Sent: Friday, 16 November 2001 5:39 PM > To: pgsql-sql@postgresql.org > Subject: [SQL] Question > > > Hello pgsql-sql, > > I have the rule for table > CREATE RULE del_jobs_del_activity AS ON DELETE TO jobs DO > DELETE FROM activities WHERE job_id = OLD.job_id; > > When i call: > DELETE FROM jobs WHERE job_id IN (SELECT DISTINCT job_id FROM > activities WHERE load_no = OLD.load_no) > This query does not delete the record from jobs but delete the > record by rule. > > Best regards, > Andriy mailto:andriy.pyrozhenko@vanjaonline.com > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org >
В списке pgsql-sql по дате отправления: