I thought of an alternative approach to the library version problem:
what about taking a leaf from the usual shared library versioning
approach, ie, put the version number into the library file name?
So instead of loading, say, "plpgsql.so" we'd insist on loading
"plpgsql.so.8.2".
This would avoid Peter's objection that the dynamic linker might give
a hard-to-interpret error message, and it'd not require assuming that
the library uses V1 function call convention either.
On the other hand, it'd be relatively easy for clueless lusers to
defeat; I can readily imagine someone copying foo.so.8.2 to foo.so.8.3
when the backend complained that it couldn't find the latter. So
maybe it's not what we want.
regards, tom lane