So I need a way to either (a) notice when I already have a (old) copy of the library loaded and avoid trying to setup the GUC in that case or (b) set-up the GUC in a somewhat less brittle way than DefineCustomStringVariable() allows, something that can overwrite things instead of just erroring out.
Are you trying to preserve the in-memory state across upgrade as well? It sounds unlikely we can support that directly in the general case.
Sounds like we need RedefineCustomStringVariable()
--
Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services