Add new variable "server_version_num", which is almost the same as

"server_version" but uses the handy PG_VERSION_NUM which allows apps to
do things like if ($version >= 80200) without having to parse apart the
value of server_version themselves.

Greg Sabino Mullane greg@turnstep.com
This commit is contained in:
Bruce Momjian 2006-09-02 13:12:50 +00:00
parent bb7be1ee10
commit 04912899e7
3 changed files with 30 additions and 5 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.78 2006/08/29 11:37:47 petere Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.79 2006/09/02 13:12:50 momjian Exp $ -->
<chapter Id="runtime-config">
<title>Server Configuration</title>
@ -4226,6 +4226,19 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem>
</varlistentry>
<varlistentry id="guc-server-version-num" xreflabel="server_version_num">
<term><varname>server_version_num</varname> (<type>integer</type>)</term>
<indexterm>
<primary><varname>server_version_num</> configuration parameter</primary>
</indexterm>
<listitem>
<para>
Reports the version number of the server as an integer. It is determined
by the value of <literal>PG_VERSION_NUM</> when building the server.
</para>
</listitem>
</varlistentry>
</variablelist>
</sect1>

View File

@ -18,9 +18,9 @@
## can be ignored
INTENTIONALLY_NOT_INCLUDED="autocommit debug_deadlocks exit_on_error \
is_superuser lc_collate lc_ctype lc_messages lc_monetary lc_numeric lc_time \
pre_auth_delay role seed server_encoding server_version session_authorization \
trace_lock_oidmin trace_lock_table trace_locks trace_lwlocks trace_notify \
trace_userlocks transaction_isolation transaction_read_only \
pre_auth_delay role seed server_encoding server_version server_version_int \
session_authorization trace_lock_oidmin trace_lock_table trace_locks trace_lwlocks \
trace_notify trace_userlocks transaction_isolation transaction_read_only \
zero_damaged_pages"
### What options are listed in postgresql.conf.sample, but don't appear

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.346 2006/08/31 15:10:51 petere Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.347 2006/09/02 13:12:50 momjian Exp $
*
*--------------------------------------------------------------------
*/
@ -220,6 +220,7 @@ static char *locale_ctype;
static char *regex_flavor_string;
static char *server_encoding_string;
static char *server_version_string;
static int server_version_num;
static char *timezone_string;
static char *timezone_abbreviations_string;
static char *XactIsoLevel_string;
@ -1627,6 +1628,17 @@ static struct config_int ConfigureNamesInt[] =
DEFAULT_EFFECTIVE_CACHE_SIZE, 1, INT_MAX, NULL, NULL
},
{
/* Can't be set in postgresql.conf */
{"server_version_num", PGC_INTERNAL, PRESET_OPTIONS,
gettext_noop("Shows the server version as an integer."),
NULL,
GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
},
&server_version_num,
PG_VERSION_NUM, PG_VERSION_NUM, PG_VERSION_NUM, NULL, NULL
},
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL