Junction table Trigger after update in another table
Your problem is , that you made  some small errors
in the for loop you need to select those columns that fit the rowtype
I added as last a Version that is better as it only update one row and not all where b.id and a.id are present


CREATE Table a
(&quot;a_id&quot; INT, &quot;a_is_active&quot; Boolean)




CREATE Table b
(&quot;b_id&quot; INT, &quot;b_is_active&quot; Boolean)




CREATE Table ab
(&quot;ab_id&quot; INT , &quot;a_id&quot; int, &quot;b_id&quot; int, &quot;ab_is_active&quot; Boolean)




INSERT INTO a VALUES (1,TRUE)




INSERT INTO B VALUES (1,TRUE)




INSERT INTO ab VALUES (1,1,1,FALSE)




DO
$BODY$
DECLARE
    b_is_active boolean;
    r            ab%ROWTYPE;
BEGIN
    for r in select ab.ab_id, ab.b_id,ab.a_id,_a.a_is_active AND _b.b_is_active AS ab_is_active
             from ab
                      join b _b on ab.b_id= _b.b_id
                      join a _a on ab.a_id= _a.a_id
        LOOP
                update ab set ab_is_active = r.ab_is_active 
                where b_id = r.b_id AND a_id = r.a_id;
        END LOOP;
END;
$BODY$;


✓




SELECT * FROM ab


ab_id | a_id | b_id | ab_is_active
----: | ---: | ---: | :-----------
    1 |    1 |    1 | t           




DO
$BODY$
DECLARE
    b_is_active boolean;
    r            ab%ROWTYPE;
BEGIN
    for r in select ab.ab_id, ab.b_id,ab.a_id,_a.a_is_active AND _b.b_is_active AS ab_is_active
             from ab
                      join b _b on ab.b_id= _b.b_id
                      join a _a on ab.a_id= _a.a_id
        LOOP
                update ab set ab_is_active = r.ab_is_active 
                where ab_id = r.ab_id;
        END LOOP;
END;
$BODY$;


✓


db&lt;&gt;fiddle here