In my house, the original 20 year old AC in the attic has a drain pan only. In a completely new system that was installed in 2020 (we have 2 separate systems, one for 1st floor and the other for 2nd floor) they installed a float switch in the drain pan.
With that being said, I do not know that our code here requires it, but for $12 it could save a lot of grief down the road if the drain pan were to overflow. It's wired to kill the power to the thermostat which will shut the whole system down but I understand in areas that can really cold, it would be wired to kill the power to the outside condensor so the homeowner could still run the furnace and not freeze to death in the winter
