Rewrite sqlite trigger to postgresql
Need parentheses in the WHEN part:

CREATE TRIGGER connections_INSERT_update_connection_root_trg
AFTER INSERT ON dionaea.connections
FOR EACH ROW
WHEN
 (NEW.connection_root IS NULL)
EXECUTE PROCEDURE dionaea.connections_INSERT_update_connection_root_trg();


You also need to return NEW in your trigger function. 

create or replace function  dionaea.connections_INSERT_update_connection_root_trg() returns trigger language plpgsql as $$
begin
  update dionaea.connections set connection_root = connection where connection = new.connection and new.connection_root is null;
  return new;
end $$;