If an individual is pulled over for a traffic stop, the presence of a legally carried firearm is not probable cause for the officer to run the serial number.
Arizona v. Hicks (Supreme Court of the US, 1987)
Yet in about 90% of cases that people have told when a police officer has disarmed them "for officer safety", they HAVE run the serial numbers. Their justification (which I think is crap) is that the serial number comes into plain sight once the gun is removed from the holster. Unfortunately, I cannot be a test case for this, because I carry a Taurus PT-145 which has the serial number plastered on the back strap, plainly visible even when the holster.