0

The code below is my code to create trigger function to change column "pass".

create or replace function change_pass()
returns trigger as
$$
begin
 NEW.pass := 'XXXXXXXXX';
 return NEW;
end
$$
language plpgsql;
create trigger change_pass
AFTER insert or update on "D_ACCOUNT"
for each row execute procedure change_pass();

When i called insert, i did not see any changes in my data. Can anyone explain to me where i was wrong?

1 Answer 1

1

You need a BEFORE trigger to change values in the NEW record:

create trigger change_pass
  BEFORE insert or update on "D_ACCOUNT"
for each row execute procedure change_pass();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.