Add unique keys check to postgres