Commit 04912899 authored by Bruce Momjian's avatar Bruce Momjian

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
parent bb7be1ee
<!-- $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"> <chapter Id="runtime-config">
<title>Server Configuration</title> <title>Server Configuration</title>
...@@ -4226,6 +4226,19 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' ...@@ -4226,6 +4226,19 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
</listitem> </listitem>
</varlistentry> </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> </variablelist>
</sect1> </sect1>
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
## can be ignored ## can be ignored
INTENTIONALLY_NOT_INCLUDED="autocommit debug_deadlocks exit_on_error \ INTENTIONALLY_NOT_INCLUDED="autocommit debug_deadlocks exit_on_error \
is_superuser lc_collate lc_ctype lc_messages lc_monetary lc_numeric lc_time \ 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 \ pre_auth_delay role seed server_encoding server_version server_version_int \
trace_lock_oidmin trace_lock_table trace_locks trace_lwlocks trace_notify \ session_authorization trace_lock_oidmin trace_lock_table trace_locks trace_lwlocks \
trace_userlocks transaction_isolation transaction_read_only \ trace_notify trace_userlocks transaction_isolation transaction_read_only \
zero_damaged_pages" zero_damaged_pages"
### What options are listed in postgresql.conf.sample, but don't appear ### What options are listed in postgresql.conf.sample, but don't appear
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>. * Written by Peter Eisentraut <peter_e@gmx.net>.
* *
* IDENTIFICATION * 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; ...@@ -220,6 +220,7 @@ static char *locale_ctype;
static char *regex_flavor_string; static char *regex_flavor_string;
static char *server_encoding_string; static char *server_encoding_string;
static char *server_version_string; static char *server_version_string;
static int server_version_num;
static char *timezone_string; static char *timezone_string;
static char *timezone_abbreviations_string; static char *timezone_abbreviations_string;
static char *XactIsoLevel_string; static char *XactIsoLevel_string;
...@@ -1627,6 +1628,17 @@ static struct config_int ConfigureNamesInt[] = ...@@ -1627,6 +1628,17 @@ static struct config_int ConfigureNamesInt[] =
DEFAULT_EFFECTIVE_CACHE_SIZE, 1, INT_MAX, NULL, NULL 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 */ /* End-of-list marker */
{ {
{NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL {NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment