Sebastian G

Sebastian G

  • NA
  • 19
  • 2.3k

Can any one say where is the mistake I did

Sep 29 2022 6:16 AM

I have created a function in such way that it call triggers where it needs to update the a column in same table after the update

But after update clause is not working for me

Where as my tigger is working for before update and insert clause

create or replace function inbound.update_lastmodified_date()
returns trigger
LANGUAGE plpgsql
AS 
$$
BEGIN
new.last_modified_date=now();
RETURN new;
END;
$$;

create or replace  trigger test_trigger  
after update  on inbound.testtriggers 
for each ROW EXECUTE PROCEDURE 
inbound.update_lastmodified_date()

This is plpgsql code, Can any one say where is the mistake I did.

Because the column is not get updated with current time after the update happening on table


Answers (1)