Check out example codes for "trigger in postgresql to change incoming entry". It will help you in understanding the concepts better.

Code Example 1

CREATE or REPLACE FUNCTION func()
RETURNS TRIGGER
AS $$
BEGIN
NEW.columnname = 0;
RETURN NEW;
END;
$$
LANGUAGE plpgsql;

-- Statement to make trigger to execute above code --
CREATE TRIGGER change_incoming BEFORE INSERT on Tablename 
FOR EACH ROW EXECUTE PROCEDURE func();

Learn ReactJs, React Native from akashmittal.com