What you describe is exactly the effects of Polymorph Any Object, which says:
This spell functions like greater polymorph, except that it changes one object or creature into another. You can use this spell to transform all manner of objects and creatures into new forms- you aren’t limited to transforming a living creature into another living form. The duration of the spell depends on how radical a change is made from the original state to its transmuted state.
Then it has a table to calculate the duration based on how different the creature's new form is compared to her original form, similar forms (human to frog) will last longer, while completely different forms (human to doorknob) will last only a few hours or minutes.
The spell even gives an example of such duration, Pebble to human (20 minutes). A sentient knob would probably be classified either as an Awakened Construct or an Animated Object. But regardless, the choice wouldn't be permanent due to the creature's kingdom changing (animal to vegetable/mineral).