Re: Auotreconnect/failover libpq

From: Oleksandr Shulgin <oleksandr(dot)shulgin(at)zalando(dot)de>
To: Marcin Giedz <marcin(dot)giedz(at)arise(dot)pl>
Cc: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Auotreconnect/failover libpq
Date: 2016-10-28 10:23:40
Message-ID: CACACo5S=2w0Xf7Qw3jYJcBKoP1BYVn9D31F6B_xor_wF6UqFYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 28, 2016 at 10:08 AM, Marcin Giedz <marcin(dot)giedz(at)arise(dot)pl>
wrote:
>
> Hello,
>
> This time question about client's autoreconnect (failover to the same
node) after disconnection. Let's assume I've got 1 node SQL server and
clients connected to this machine. Is there any native autoreconnect method
in libpq (client's software uses libpq C++) - something like SELECT 1 or
other options available for clients to (re)establish connection to the
server again after they loose it ? or I need to implement this myself ?

Hi,

PQreset might be the interface you are looking for:
https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-PQRESET

This is how psql handles re-connection when its current connection gets
closed in an interactive session.

--
Alex

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Banck 2016-10-28 10:40:24 Fast Primary shutdown only after wal_sender_timeout
Previous Message Marcin Giedz 2016-10-28 08:08:26 Auotreconnect/failover libpq