From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Add psql variables showing server version and psql version.
Date: Tue, 5 Sep 2017 20:58:37 +0200 (CEST)
Message-ID: <alpine.DEB.2.20.1709052051590.17848@lancre> (raw)
In-Reply-To: <CANP8+jLGoZKRA-HT2yqfg4YJiPsJ+qe0aKTpGbNsntbz-396WQ@mail.gmail.com>
References: <E1dpFCX-0004YD-E7@gemulon.postgresql.org>
<CANP8+j+WC3zXTJrMQgfX1_TB23FmWzbiN71yWThb0N4gdvBgZQ@mail.gmail.com>
<2774.1504628172@sss.pgh.pa.us>
<CA+TgmoZpe2YJdFLFH6YSka5TVX4VcsmT05cEXWOHxJ2wzCBE2w@mail.gmail.com>
<4782.1504630716@sss.pgh.pa.us>
<CANP8+jLGoZKRA-HT2yqfg4YJiPsJ+qe0aKTpGbNsntbz-396WQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hello Simon,
> Does raise the further question of how psql behaves when we connect to
> a pre-10 server, so we have SERVER_VERSION_NUM but yet it is not set.
> How does this
> \if SERVER_VERSION_NUM < x
The if does not have expressions (yet), it just handles TRUE/ON/1 and
FALSE/0/OFF.
> Do we need some macro or suggested special handling?
If "SERVER_VERSION_NUM" is available in 10, then:
-- exit if version < 10 (\if is ignored and \q is executed)
\if false \echo "prior 10" \q \endif
-- then test version through a server side expression, will work
SELECT :SERVER_VERSION_NUM < 110000 AS prior_11 \gset
\if :prior_11
-- version 10
\else
-- version 11 or more
\endif
--
Fabien.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: coelho@cri.ensmp.fr, simon@2ndquadrant.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Add psql variables showing server version and psql version.
In-Reply-To: <alpine.DEB.2.20.1709052051590.17848@lancre>
References: <E1dpFCX-0004YD-E7@gemulon.postgresql.org> <CANP8+j+WC3zXTJrMQgfX1_TB23FmWzbiN71yWThb0N4gdvBgZQ@mail.gmail.com> <2774.1504628172@sss.pgh.pa.us> <CA+TgmoZpe2YJdFLFH6YSka5TVX4VcsmT05cEXWOHxJ2wzCBE2w@mail.gmail.com> <4782.1504630716@sss.pgh.pa.us> <CANP8+jLGoZKRA-HT2yqfg4YJiPsJ+qe0aKTpGbNsntbz-396WQ@mail.gmail.com> <alpine.DEB.2.20.1709052051590.17848@lancre>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox