Re: Question

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Andriy Pyrozhenko" <andriy(dot)pyrozhenko(at)vanjaonline(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Question
Date: 2001-11-23 01:45:51
Message-ID: GNELIHDDFBOCMGBFGEFOCEIHCAAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
> [mailto:pgsql-sql-owner(at)postgresql(dot)org]On Behalf Of Andriy Pyrozhenko
> Sent: Friday, 16 November 2001 5:39 PM
> To: pgsql-sql(at)postgresql(dot)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(dot)pyrozhenko(at)vanjaonline(dot)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
>

In response to

  • Question at 2001-11-16 09:38:30 from Andriy Pyrozhenko

Responses

  • Re: Question at 2001-11-23 07:14:54 from Andriy Pyrozhenko

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Kings-Lynne 2001-11-23 01:48:18 Re: SELECT * FROM t where p or q;
Previous Message Christopher Kings-Lynne 2001-11-23 01:42:22 Re: "posttime" time DEFAULT now()