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 1h2H9p-0003zf-Ei for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2019 15:11:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h2H9n-0008CC-9O for pgsql-hackers@arkaria.postgresql.org; Fri, 08 Mar 2019 15:11:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h2H9m-0008C5-VG for pgsql-hackers@lists.postgresql.org; Fri, 08 Mar 2019 15:11:31 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h2H9j-0005Zd-Um for pgsql-hackers@postgresql.org; Fri, 08 Mar 2019 15:11:29 +0000 Received: by fetter.org (Postfix, from userid 1001) id BE0F34042F; Fri, 8 Mar 2019 16:11:25 +0100 (CET) Date: Fri, 8 Mar 2019 16:11:25 +0100 From: David Fetter To: Peter Eisentraut Cc: Magnus Hagander , pgsql-hackers Subject: Re: psql show URL with help Message-ID: <20190308151125.GL10435@fetter.org> References: <47e071fd-8997-f036-b383-4d80c184adeb@2ndquadrant.com> <20190303181432.GA316@fetter.org> <20190303214833.GD10435@fetter.org> <20190307220234.GI10435@fetter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Mar 08, 2019 at 01:45:03PM +0100, Peter Eisentraut wrote: > On 2019-03-07 23:02, David Fetter wrote: > >> if (psql_version_is_numeric) > >> return /docs/psql_version/ > >> else if (psql_version ends with 'devel') > >> return /docs/devel/ > >> else > >> return /docs/{psql_version but with text stripped}/ > >> > >> So that e.g. 12beta would return "12", as would 12rc or 12alpha. But > >> 12devel would return "devel". > > > > That's exactly what I had in mind :) > > The outcome of that is exactly what my patch does, but the inputs are > different. We have PG_MAJORVERSION, which is always a single integer, > and PG_VERSION, which could be 10.9.8 or 11beta5 or 12devel. The patch does > > if (PG_VERSION ends with 'devel') > return /docs/devel/ > else > return /docs/$PG_MAJORVERSION/ > > There is no third case. Your third case of not-numeric-and-not-devel is > correctly covered by the else branch. Thanks for helping me understand. Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate