I have a simple trigger function in PostgreSQL 9.4:
 BEGIN 
 IF (TG_OP = 'UPDATE') THEN 
 UPDATE relation 
 SET child_name = new.name 
 WHERE table_reference_1 = new.id; 
 END IF; 
 RETURN NULL; 
 END;
Is it possible to replace table_reference_1 (which is column name) with variable? I want to do something like:
 BEGIN 
 IF (TG_OP = 'UPDATE') THEN 
 UPDATE relation 
 SET child_name = new.name 
 WHERE TG_TABLE_NAME = new.id; 
 END IF; 
 RETURN NULL; 
 END; 
WHERE TG_TABLE_NAME = new.id is supposed to mean:
"new.id is equal to the value of the column, whose name is equal to the parent table's name".
 
     
    