From 9ae9d8c1549c384dbdb8363e1d932b7311d25c56 Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Tue, 5 Sep 2017 10:51:36 -0400
Subject: Add psql variables showing server version and psql version.
We already had a psql variable VERSION that shows the verbose form of
psql's own version. Add VERSION_NAME to show the short form (e.g.,
"11devel") and VERSION_NUM to show the numeric form (e.g., 110000).
Also add SERVER_VERSION_NAME and SERVER_VERSION_NUM to show the short and
numeric forms of the server's version. (We'd probably add SERVER_VERSION
with the verbose string if it were readily available; but adding another
network round trip to get it seems too expensive.)
The numeric forms, in particular, are expected to be useful for scripting
purposes, now that psql can do conditional tests.
Fabien Coelho, reviewed by Pavel Stehule
Discussion: https://postgr.es/m/alpine.DEB.2.20.1704020917220.4632@lancre
---
doc/src/sgml/ref/psql-ref.sgml | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index c592edac60a..868de184184 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -3670,6 +3670,21 @@ bar
+
+ SERVER_VERSION_NAME
+ SERVER_VERSION_NUM
+
+
+ The server's version number as a string, for
+ example 9.6.2>, 10.1> or 11beta1>,
+ and in numeric form, for
+ example 90602> or 100001>.
+ These are set every time you connect to a database
+ (including program start-up), but can be changed or unset.
+
+
+
+
SHOW_CONTEXT
@@ -3733,10 +3748,15 @@ bar
VERSION
+ VERSION_NAME
+ VERSION_NUM
- This variable is set at program start-up to
- reflect psql>'s version. It can be changed or unset.
+ These variables are set at program start-up to reflect
+ psql>'s version, respectively as a verbose string,
+ a short string (e.g., 9.6.2>, 10.1>,
+ or 11beta1>), and a number (e.g., 90602>
+ or 100001>). They can be changed or unset.
--
cgit v1.2.3