The Magic Haddock

The Magic Haddock was a short story, the moral of which was to be careful what you wish for. The Twelfth Doctor recited the story to the colonists of a planet visited by him, following an incident in which the planet's Emojibots went rogue. (TV: Smile)

"Once, long ago, a fisherman caught a magic haddock. The haddock offered the fisherman three wishes in return for its life. The fisherman said, “I’d like for my son to come home from the war and a hundred pieces of gold.” The problem is that magic haddock, like robots, don’t think like people. The fisherman’s son came home from the war, in a coffin and the king sent a hundred gold pieces in recognition of his heroic death. The fisherman had one wish left. What do you think he wished for? Some people say he should have wished for an infinite series of wishes, but if your city proves anything, it is that granting all your wishes is not a good idea. [...] In fact, the fisherman wished he hadn’t wished the first two wishes."

- The Doctor tells the story of "The Magic Haddock"

Trivia

 * The story of The Magic Haddock appears to be based on two real life stories.
 * The first story is "The Tale of the Fisherman and the Fish", a fairy tale about a fish that grants wishes in exchange for its freedom, only for the fisherman to make his final wish to be for everything to return to normal. The fisherman made this wish after his wife became corrupted by her own greed when she kept forcing the fisherman to go back to the beach in order to gain more wishes.
 * The second story is "The Monkey's Paw" by W. W. Jacobs, a short story about a couple who gain a monkey's paw that can grant wishes at a deadly cost. Like in The Magic Haddock, the couple wished for money and got it as compensation for their son's death and their final wish was for their previous wishes to be undone.