I took the liberty of rebasing this series on top of recent branch master. The first four are mostly Paul's originals, except for conflict fixes; the rest are changes I'm proposing as I go along figuring out the whole thing. (I would post just my proposed changes, if it weren't for the rebasing; apologies for the messiness.)
I am not convinced that adding TYPTYPE_MULTIRANGE is really necessary. Why can't we just treat those types as TYPTYPE_RANGE and distinguish them using TYPCATEGORY_MULTIRANGE? That's what we do for arrays. I'll try to do that next.
I think the algorithm for coming up with the multirange name is suboptimal. It works fine with the name is short enough that we can add a few extra letters, but otherwise the result look pretty silly. I think we can still improve on that. I propose to make makeUniqueTypeName accept a suffix, and truncate the letters that appear *before* the suffix rather than truncating after it's been appended.
There's a number of ereport() calls that should become elog(); and a bunch of others that should probably acquire errcode() and be reformatted per our style.
Regarding Pavel's documentation markup issue,
> I am not sure how much is correct to use <literallayout class="monospaced"> > in doc. It is used for ranges, and multiranges, but no in other places
I looked at the generated PDF and the table looks pretty bad; the words in those entries overlap the words in the cell to their right. But that also happens with entries that do not use <literallayout class="x">! See [1] for an example of the existing docs being badly formatted. The docbook documentation [2] seems to suggest that what Paul used is the appropriate way to do this.
Maybe a way is to make each entry have more than one row -- so the example would appear below the other three fields in its own row, and would be able to use the whole width of the table.
I had a talk with Paul about possible simplification of designed operators. Last message from Paul was - he is working on new version.