You forgot to pass the res to pgfdw_report_error for proper logging. I fixed this in the patch I posted just before.
+1
> I've update the logic that we don't try to fetch attrstats if the reltuples is 0 or -1, and though the comments still mention the difference in server version, the code behaves the same in new versions and old. My thinking is that either value means "you are not going to find attstats" and our reaction is the same either way.