Found it. The clue was the libpq.so.4, which as Dirk said, was from an older postgresql build. I wondered why my postgres kept reporting version 4 rather than the 5 I had installed, and searched the build logs. It seems that the library information is reported by pg_config, and that my /usr/bin/pg_config was left over from the old install and not deleted/clobbered by eselect-postgresql.
An eselect postgresql reset-all / set-all / update got me back in action.