Hello Alvaro,
> Any objections to changing it like this?  I'd probably backpatch to 9.5,
> but no further (even though this pattern actually appears all the way
> back.)
My 0.02€: if the pattern is repeated, maybe a function which incorporates 
the check would save lines and improve overall readability?
    ... = safePQsocket(...);
-- 
Fabien.