Fixing issue with historical identity-link upgrade-sql on postgres