Gary Stainburn <gary.stainburn@ringways.co.uk> writes:
> How does Postgresql handle this? I would hope that it would notice the loss
> of the IP connection and close the link gracefully, and not just leave the
> connectino dangling.
The backend runs the connection with TCP_KEEPALIVE set. The kernel
should recognize the loss of connectivity after awhile ("awhile" means
an hour or more if your kernel does this in an RFC-compliant fashion)
and inform the backend, which will roll back any open transaction and
then shut down.
If connectivity was lost while active data transfer was going on,
it will probably only take a few minutes for the kernel to declare
connection loss. But if you were sitting idle, nothing will happen
until the kernel issues a KEEPALIVE probe, which it shouldn't do very
often.
regards, tom lane