I wrote: > A fairly common solution to that is to return NULL for bad input, > but in this case we could just have it return the OID unchanged.
After sleeping on it, I concluded that was a bad idea and we'd be best off returning NULL for invalid type OIDs. So this is just about back to Steve's original proposal, except for being a bit more bulletproof against races with DROP TYPE. Pushed that way. regards, tom lane