When a dog ( or coyote ) attacks a porcupine, the dog seldom wins.The coyote without help ( from a vet ) will most likely die a very slow and painful death.
The animals first instinct when spotting a porcupine, is to bite down on the critter thus filling his mouth with the quills. Not being able to eat or drink usually leads to the death of the animal. The quills are barbed and designed to migrate in with muscle contractions of the animal. Some have been reported to have migrated slowly through the brain or optics.
Porcupines do not throw their quills, that is a myth. They are strictly for defense and come out real easy when agitated.
Letting ones dog, run at large, is not a smart idea and at worst could cost the life of the dog, at best, a real heavy vet bill and unnecessary trauma to the dog.