Re: Can I tell libpq to connect to the primary?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Christian Ramseyer <rc(at)networkz(dot)ch>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Can I tell libpq to connect to the primary?
Date: 2020-04-24 07:12:50
Message-ID: 20200424071250.GN33034@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Apr 23, 2020 at 08:54:35AM +0200, Christian Ramseyer wrote:
> Never mind, after RTFM'ing to the very end of
> https://www.postgresql.org/docs/current/libpq-connect.html I have
> discovered target_session_attrs=read-write|any which seems to do exactly
> what I want.

Yes, as long as you don't have as requirement to make sure to connect
to a standby session this would not be a problem. Supporting a
read-only mode for target_session_attrs is a problem we have been
stuck on for some time because of the potential issues you could face
when attempting to connect a cluster that has just been freshly
promoted: when connecting to the server libpq may see the connection
as read-only but if the standby gets promoted that could become
incorrect.
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Amaury Bouchard 2020-04-24 12:53:38 Weird behaviour of C extension function
Previous Message Preethi S 2020-04-24 01:12:54 Re: Reg: Help to understand the source code