I am building a distance matrix with this SQL statement:
INSERT INTO tabel (start, end, agg_cost)
SELECT * FROM pgr_dijkstraCostMatrix(
'SELECT id, source, target, cost, reverse_cost FROM edges',
(SELECT array_agg(id) FROM vertices
WHERE (vertices.eout =1) OR (vertices.eout >15) )
);
That works fine.
How do I prevent INSERT when the combination of 'start' and 'end' already exist in table? I am looking for another WHERE clause, but can not find out where to put it.