Assuming it's constipation (which may not be the actual case here, as straining for both peeing and pooping can look similar, only your vet will be able to tell for sure with an examination)

Not 'going as often' and small hard stools passed with difficulty (with or without watery discharge) is generally a sign of constipation. My cat Jack has to be on pumpkin every day for constipation, and just happens to love eating it as well. lol

Eating things pets shouldn't can cause constipation, but also a possiblility of totally stopping up the works which is life threatening. You might have to hide the garbage cans or whatever to keep your dog from getting into things.

I'd ask your vet about the dog's regular diet if it may be causing the constipation. Also ask to make sure it's ok to give the pumpkin every day as a maintenance preventative. Also try to get your dog to drink plenty of fresh water, that helps sometimes.

I'd be suspicious of a vet that goes right to IBS (irritable bowel syndrome) too quickly without at least trying some of the more simple alternatives, barring a complete blockage which would require immediate treatment.

Good luck at the vets, just make sure if there's anything you don't understand, ASK questions until you do understand. A good vet shouldn't have a problem explaining things a few different ways so the owners can truely understand what's going on with their furbaby.