Oracle and SQL Server don't have exactly the same limitations. It's worth treating them differently. Backport of cff59bed from master