Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing serverversion and psql version.

Поиск
Список
Период
Сортировка
Искать
От
Fabien COELHO
Тема
Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing serverversion and psql version.
Дата
Msg-id
alpine.DEB.2.20.1709052051590.17848@lancre
Ответ на
Список
Дерево обсуждения
Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing server version and psql version. Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing serverversion and psql version. Simon Riggs <simon@2ndquadrant.com>
Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing server version and psql version. Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing serverversion and psql version. Fabien COELHO <coelho@cri.ensmp.fr>
Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing server version and psql version. Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] [COMMITTERS] pgsql: Add psql variables showing serverversion and psql version. Fabien COELHO <coelho@cri.ensmp.fr>

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.


В списке pgsql-hackers по дате отправления
От: Andres Freund
Дата:
От: Fabien COELHO
Дата:
FAQ