Did he have a right to do it? Obviously. But that doesn't mean he wasn't a moron.
Assuming the OP is accurately describing the situation (i.e., the dog was a hobbling golden retriever), he took action that just wasn't necessary.
The child being injured is not a foreseeable result - I don't really fault the mailman for that. I just think he should refrain from pepper spraying wiener dogs or hobbling animals.