Ducks need grit so they can "chew" in their tummies (I know there are more technical terms, but I think you know what I mean). If your little one is outdoors he is most likely getting plenty of grit from dabbling around on the ground, picking up bits of soil and gravel.
If the pumpkin is in fairly large chunks so he would have to rip pieces of it off, that ought to be okay.
But if the pumpkin is in sizes that might be swallowable, but large enough to get stuck, that could be a problem.
Since they don't chew with their mouths, they swallow things whole, so they can choke if what they are swallowing is too large and certain kinds of shapes and textures could get stuck part of the way down. We don't want to lose a duck to suffocation.
So for some items I do cut the pieces small enough so that they will go down without getting stuck. Other things start out too large to swallow and they rip pieces off that are small enough to eat safely.
He just may not realize it's food yet.
Did you slice it in half? That might get him started. Just watch him for a while with it.
By the way, Storey's Guide to Raising Ducks suggests keeping a foot-long length of half-inch rubber tubing or something similar to use in case of choking.
I think they said even a non-sharpened wooden pencil with a clean eraser, using the eraser side down could work.