Our very first pig, Sir Barnabas Jerome of Furry Face, was diagnosed by a cavy-knowledgeable vet with a condition called acquired megacolon. This is probably most similar to the same kind of condition in rats. A "stretched out" colon, where waste material can accumulate, is probably a rough and simple description.
He defecated in cycles -- that is, large, soft clumps; then something fairly normal, then very very tiny, then none at all until I worked a large compacted mass of tiny feces out of his perianal sac. Then the process began again.
He liked hay but it gave him fits. He couldn't digest or pass it. We gave him unlimited (and I do mean unlimited; we went through two heads of lettuce a DAY, and no, that is not a typo) greens; some fruits, some Critical Care, and pellet stew.
He lived for four (4) years with this condition. He felt lousy when he felt lousy, and felt good when he didn't. He had a very strong personality and character, without which I doubt he would have made it as long, or as well, as he did.
We gave him Reglan on occasion. We tried Cisapride and it very nearly caused him seizures. Cisapride works on the lower GI and may help this condition, but use it with **extreme** caution.