I am facing an issue where On my store more than 2 products have the same name things are going fine on a low range of products, As Magento will update URL on saving in the catalog_url_rewrite table if found same name products, and will allocate a free Path which is not in use.
But later we have found an issue that the URL is different in the table and when we open that product it will show different URL.
My table has some custom URLs as well, that is not generated by the system, that is generated by me.
I truncate the table and import the custom URL generated by me and do the reindexing so all the system generated URL will be created in the table.
But the issue remains the same.
Is there any way to check url key if already in the system so admin needs to update product name or key before save, As magento2.