Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRsWL-00027t-4U for pgsql-general@arkaria.postgresql.org; Fri, 24 Apr 2020 07:13:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jRsWJ-0000LI-PD for pgsql-general@arkaria.postgresql.org; Fri, 24 Apr 2020 07:13:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRsWJ-0000LB-HX for pgsql-general@lists.postgresql.org; Fri, 24 Apr 2020 07:13:07 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRsWD-0003jG-AA for pgsql-general@lists.postgresql.org; Fri, 24 Apr 2020 07:13:06 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id E01CA5C0A9C; Fri, 24 Apr 2020 03:12:59 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 24 Apr 2020 03:12:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=k+XFK0etayFUUXC2P+miKQLOhwD VDZHmCUJd1TqW0wE=; b=COqqyjtHNDz5qP4x1ZUJBhxpFM0LwBq2ntvsIduVQCZ g9yGgf/we7r33NDb2Xr4exyblIVTyy95qJ6pWVY5135mR9uv4zUjPcGi2DvGIyud 7Bx1/2QcSEfcTcjbdksIF3Cyl4rD3Cg2ZI/LB223evddMRcYs3AQJEEeAkQJbTpq 1F7Kxp6Bdqvf3+WYRB3D19rCm7elHPoErjh8QCTS0jpKY82YKb/d+VP1wZpCD9q7 7SxmHCN1i7ohLPCqnW/8ogG4rLdajvNhxeGYAOFPCiHwhCNBwhCVYKzNDZVoQJcI Uolyi9lZXX2vtO6VjSmHttPDtKu/fI7elKQP92XDC0A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=k+XFK0 etayFUUXC2P+miKQLOhwDVDZHmCUJd1TqW0wE=; b=Kik7LjTEQ4f64u4RuXcr7H ikEPIAfvyo2cHtjYUozsfYjqEhYbLkZeZ+q/OdC+2zFa33kVBONiyrs1TQK1PYdS 4TVXgGqBQyVNmjg7tYM5P+DiJ5v2PoDHnkhe+JS9tDDz4KPH7961oQ39boEN+7VO KzjLc5IguyAP8U/ARqSADqTOMQfIWa1CbM1vRje0lVmfRzuVzuWbasGg4vkJvSos vsKKIlccBg2CNLozmXOwIg7e5csonrfcck3ehOJUqHoOmRDJzqg0p8kYEnsxGgPq Jow+BBn9NTwH6wOz2FiupTGXXxe8n4dbWeF5Lvv1K+V4fmtjV6L0LyEfzlhb/c2g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrhedtgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecu kfhppeduuddurddutddvrddukedtrddukeehnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 4FCF6328005E; Fri, 24 Apr 2020 03:12:55 -0400 (EDT) Date: Fri, 24 Apr 2020 16:12:50 +0900 From: Michael Paquier To: Christian Ramseyer Cc: pgsql-general@lists.postgresql.org Subject: Re: Can I tell libpq to connect to the primary? Message-ID: <20200424071250.GN33034@paquier.xyz> References: <77fdd49c-2977-6e68-1206-fade93701d72@networkz.ch> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jo46wx5DSA4a/gWG" Content-Disposition: inline In-Reply-To: <77fdd49c-2977-6e68-1206-fade93701d72@networkz.ch> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --jo46wx5DSA4a/gWG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --jo46wx5DSA4a/gWG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl6ikXIACgkQnvQgOdby QH3UoA/9HQUOr4aHWZ2kXhz2OosgV3lI06EZwBac/BNiLaASY6z7JOm7jsW56fD/ lSonemkKDVyzWc2grvT93PL42midtGXLZfkbpLTr19PV2Go4aJf5kqkWHaLZieA1 aI0ey46ecbCtJnlsWF6jQ+p8w97Y06HxY/eGlelBvFT+VltO4ImCMLWO6X16eWEB sEFpXVMRgT833Wy3SaVBDyKkkD/iUc26u7lABDIg6JJujahV/rWH05c8Qz8+5ZRj oa0z2bhTQodO7OGZlpI17lswr488qX2yLIUBJZdtRNBzL77gceGx6ly6I6H38Hu/ EHbKcmCY3efTDcAFs5NMQAj64CUingoRntwgX04B6mCY484vW3S04fz9y20YlAqh ZZ4M70yfq3My3Uo6TmI6lFfjuM5EDn5cF1YrDv4ZFFK9UqpvffSHUqvNchPAXNOw qbTdDqOzDi2DXyhB429R2F+Mb4CIa+TXINYl+jHZkyF2VFlvZ22jkWYTBjSbKoCo SsgURjprX+jb0+2EQFX+kjb4QUYxwW2Nr66n3UnaSyY1O8im5uiCdj+d3Uqa9rEH ASjnhJ1gY/KlDS2wJl8PSRPjzOv2ERd/B5zN5BzBtH9BT7RgGLiqBz/ZFmcRMwsj RUPD5YOaoWKsPPZ90t6RrUEiRK6rblpm/7YWPMY7tuuOv64jv6Q= =FR89 -----END PGP SIGNATURE----- --jo46wx5DSA4a/gWG--