Re: Question - Mailing list pgsql-sql

From Christopher Kings-Lynne
Subject Re: Question
Date
Msg-id GNELIHDDFBOCMGBFGEFOCEIHCAAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to Question  (Andriy Pyrozhenko <andriy.pyrozhenko@vanjaonline.com>)
Responses Re: Question  (Andriy Pyrozhenko <andriy.pyrozhenko@vanjaonline.com>)
List 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 by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: "posttime" time DEFAULT now()
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: database cluster