I have the table with a booolan
column and an updated trigger when I call the column value Clearly try to update from FALSE
to TRUE
, then the values in the column are true, i.e. the old being FALSE
and NEW is going to correct
. When I try to change from TRUE
to FALSE
, then there will be FALSE
in both Old and New.
Has this strange behavior been experienced?
Below are some trigger functions, the business logic that I thought was irrelevant:
create or restart locker_before_state_update () $ $ DECLARE l_reservation_id INT; BEGIN - pg_notify ('locker_is_alive_update', 'N' || NEW) for performance execution; Execution pg_notify ('locker_is_alive_update', 'o' = old); - This check will be unsuccessful, when updates are incorrect (NEW.state = OLD.state) and (OLD.is_alive <> NEW.is_alive) then execute pg_notify ('locker_is_alive_update', NEW.id | | ',' New .is_alive); Return null; end if; ... returns new; END $ $ LANGUAGE plpgsql; Create Trigger Locker_bierfi_state_update_trigger Locker_bier_state_update () on the locker for each row's execution process;
You should feel strange behavior because you NULL
What is actually happening inside your statement is that this update is not done at all. I replaced it with return tap
and replaced return new
and it worked as expected if part:
if (new .state = old .state) and (old.is_live
No comments:
Post a Comment