Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjErR-0003xk-O8 for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jan 2019 02:53:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gjErQ-0007sD-43 for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Jan 2019 02:53:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjErP-0007s6-TG for pgsql-hackers@lists.postgresql.org; Tue, 15 Jan 2019 02:53:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gjErN-00008X-EM for pgsql-hackers@postgresql.org; Tue, 15 Jan 2019 02:53:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x0F2rHYj030680; Mon, 14 Jan 2019 21:53:17 -0500 From: Tom Lane To: Michael Paquier cc: "Tsunakawa, Takayuki" , Dave Cramer , Robert Haas , "laurenz.albe@cybertec.at" , Haribabu Kommi , Jing Wang , PostgreSQL-development Subject: Re: Libpq support to connect to standby server as priority In-reply-to: <20190115024855.GC1433@paquier.xyz> References: <67be09458f276c0c95a4b2a2a383dca9775d19cd.camel@cybertec.at> <26890.1542047012@sss.pgh.pa.us> <096a642cff0dd68b8157a5f8838e1762d0050d18.camel@cybertec.at> <28777.1542386147@sss.pgh.pa.us> <26251.1547504236@sss.pgh.pa.us> <0A3221C70F24FB45833433255569204D1FB67687@G01JPEXMBYT05> <20190115024855.GC1433@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Tue, 15 Jan 2019 11:48:55 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30678.1547520797.1@sss.pgh.pa.us> Date: Mon, 14 Jan 2019 21:53:17 -0500 Message-ID: <30679.1547520797@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Tue, Jan 15, 2019 at 02:00:57AM +0000, Tsunakawa, Takayuki wrote: >> The original desire should have been the ability to connect to a >> primary or a standby. So, I think we should go back to the original >> thinking (and not complicate the feature), and create a read only >> GUC_REPORT variable, say, server_role, that identifies whether the >> server is a primary or a standby. > From the point of view of making sure that a client is really > connected to a primary or a standby, this is the best idea around. There are a couple of issues here: 1. Are you sure there are no use-cases for testing transaction_read_only as such? 2. What will the fallback implementation be, when connecting to a server too old to have the variable you want? regards, tom lane