On 10/25/2004 3:47 PM, Tom Lane wrote:

"Naeem Bari" <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED])


--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== [EMAIL PROTECTED] #

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to [EMAIL PROTECTED] so that your
     message can get through to the mailing list cleanly

Reply via email to