From: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Naeem Bari <naeem(dot)bari(at)agilissystems(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: ON DELETE trigger blocks delete from my table |
Date: | 2004-10-25 20:16:26 |
Message-ID: | 417D5F1A.8000307@Yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 10/25/2004 3:47 PM, Tom Lane wrote:
> "Naeem Bari" <naeem(dot)bari(at)agilissystems(dot)com> writes:
>> CREATE OR REPLACE FUNCTION public.func_job_status_upd()
>> RETURNS trigger AS
>> '
>> begin
>> insert into x_job_status values ( OLD.job_id, OLD.job_status_type_id,
>> OLD.status_date, OLD.notes, OLD.edit_person_id, OLD.edit_date);
>> return new;
>> end;
>> '
>> LANGUAGE 'plpgsql' VOLATILE;
>
> If this is a BEFORE trigger, you probably need "RETURN OLD". "NEW" will
> be NULL in a delete trigger, so you're returning NULL which cancels the
> operation.
... which would then again not work for the UPDATE case (not with the
same internal consequences though).
Jan
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2004-10-25 20:27:20 | Re: ON DELETE trigger blocks delete from my table |
Previous Message | Edmund Bacon | 2004-10-25 20:15:55 | Re: ON DELETE trigger blocks delete from my table |