From: | Jaime Casanova <systemguards(at)gmail(dot)com> |
---|---|
To: | "surabhi(dot)ahuja" <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: regarding triggers |
Date: | 2006-01-10 16:00:52 |
Message-ID: | c2d9e70e0601100800p7cf522a2j491d7b703d4c985e@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 1/10/06, Jaime Casanova <systemguards(at)gmail(dot)com> wrote:
> On 1/10/06, surabhi.ahuja <surabhi(dot)ahuja(at)iiitb(dot)ac(dot)in> wrote:
> >
> >
> > is there an advantage of using a trigger? when the same job can be performed
> > by a stored procedure?
> >
>
a trigger is actually a stored procedure... the advantage is that it's
called automagically when an event happens...
>
> > one more question is as follows:
> > suppose i have a table x, with a primary attribute 'a'
> >
> > and i have a table y, with the primary attribute 'b', and a foreign key 'a'.
> >
> > suppose i say delete from x where a = '1',
> >
> > it means that not only the rows from x get deleted but also rows from y get
> > deleted.
> >
>
only if you specified ON DELETE CASCADE at FOREIGN KEY creation
> > now i have a trigger which is written for deletes taking place from the
> > table y.
> >
> > however if i say delete from x where a = '1',
> >
> > will the trigger (mentioned above) still be called? (because delete are also
> > taking place from the table y)
> >
>
if the DELETE will CASCADE, yes
> > thanks,
> > regards
> > Surabhi
>
>
--
regards,
Jaime Casanova
(DBA: DataBase Aniquilator ;)
From | Date | Subject | |
---|---|---|---|
Next Message | John Sidney-Woollett | 2006-01-10 16:14:48 | Re: Sequence Manipulation Functions |
Previous Message | MG | 2006-01-10 14:56:04 | Sequence Manipulation Functions |