Dogs can be trained to discriminate.
It is possible to mitigate such behavior, through a sort of doggie diversity training, whereby the pet is gradually exposed to what sets it off. But it can be hard to persuade your black or white-bearded friends to participate in such cultural immersion exercises. (My friends had serendipitously hired a black trainer for Percy, whose behavior has since improved.) And even careful training can never totally eliminate the possibility that a trigger too similar to the traumatic event could cause the dog to lash out.
story via slate