It's possible the dog could be missing something in his diet.

We had a St Bernard/Golden x years ago. We had just started learning the difference between good food and not so good food. At the time, we were feeding Nutro Max (upgraded from Mainstay).

Barney started licking the carpet, not all the time, but once in a while, and he would be trying to heave. We would let him outside, he ate grass and would be sick. This went on for years. At that time, we were never able to find out what caused it, vet didn't know.

It wasn't until we got Misty, and I was getting the right food for her and talking to the homeopath, that she told me it was probably the food. I don't remember why she told me the food caused the reaction, but I do remember her saying it was a common problem with some dogs on that food.