add insert into ts_relations in distinct