Adrian Klaver <adrian.klaver@xxxxxxxxxxx> writes: > On 03/20/2018 11:52 AM, Albrecht Dreß wrote: >> I use Postgres 10.3 on a Debian Stretch system with foreign tables, and >> noticed strange LOG messages when accessing them. >> [time stamp/pid] user@my_db LOG: could not receive data from client: >> Connection reset by peer > My suspicion is it has to do with this: > postgres_fdw establishes a connection to a foreign server during the > first query that uses a foreign table associated with the foreign > server. This connection is kept and re-used for subsequent queries in > the same session. Perhaps. It's not entirely clear if these complaints are about the original user session or the sub-session opened by postgres_fdw. (Albrecht, if you're not sure either, enabling log_connections and log_disconnections might make it clearer.) I don't see any such log messages when testing postgres_fdw here, which is odd; why are my results different? If these are about the FDW connections, maybe the answer is that postgres_fdw ought to establish a backend-exit callback in which it can shut down its connections gracefully. If it's doing that now, I sure don't see where. regards, tom lane