Skip to content

Commit 0491289

Browse files
committed
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
1 parent bb7be1e commit 0491289

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

doc/src/sgml/config.sgml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.78 2006/08/29 11:37:47 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.79 2006/09/02 13:12:50 momjian Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -4226,6 +4226,19 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
42264226
</listitem>
42274227
</varlistentry>
42284228

4229+
<varlistentry id="guc-server-version-num" xreflabel="server_version_num">
4230+
<term><varname>server_version_num</varname> (<type>integer</type>)</term>
4231+
<indexterm>
4232+
<primary><varname>server_version_num</> configuration parameter</primary>
4233+
</indexterm>
4234+
<listitem>
4235+
<para>
4236+
Reports the version number of the server as an integer. It is determined
4237+
by the value of <literal>PG_VERSION_NUM</> when building the server.
4238+
</para>
4239+
</listitem>
4240+
</varlistentry>
4241+
42294242
</variablelist>
42304243
</sect1>
42314244

src/backend/utils/misc/check_guc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
## can be ignored
1919
INTENTIONALLY_NOT_INCLUDED="autocommit debug_deadlocks exit_on_error \
2020
is_superuser lc_collate lc_ctype lc_messages lc_monetary lc_numeric lc_time \
21-
pre_auth_delay role seed server_encoding server_version session_authorization \
22-
trace_lock_oidmin trace_lock_table trace_locks trace_lwlocks trace_notify \
23-
trace_userlocks transaction_isolation transaction_read_only \
21+
pre_auth_delay role seed server_encoding server_version server_version_int \
22+
session_authorization trace_lock_oidmin trace_lock_table trace_locks trace_lwlocks \
23+
trace_notify trace_userlocks transaction_isolation transaction_read_only \
2424
zero_damaged_pages"
2525

2626
### What options are listed in postgresql.conf.sample, but don't appear

src/backend/utils/misc/guc.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.346 2006/08/31 15:10:51 petere Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.347 2006/09/02 13:12:50 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -220,6 +220,7 @@ static char *locale_ctype;
220220
static char *regex_flavor_string;
221221
static char *server_encoding_string;
222222
static char *server_version_string;
223+
static int server_version_num;
223224
static char *timezone_string;
224225
static char *timezone_abbreviations_string;
225226
static char *XactIsoLevel_string;
@@ -1627,6 +1628,17 @@ static struct config_int ConfigureNamesInt[] =
16271628
DEFAULT_EFFECTIVE_CACHE_SIZE, 1, INT_MAX, NULL, NULL
16281629
},
16291630

1631+
{
1632+
/* Can't be set in postgresql.conf */
1633+
{"server_version_num", PGC_INTERNAL, PRESET_OPTIONS,
1634+
gettext_noop("Shows the server version as an integer."),
1635+
NULL,
1636+
GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE
1637+
},
1638+
&server_version_num,
1639+
PG_VERSION_NUM, PG_VERSION_NUM, PG_VERSION_NUM, NULL, NULL
1640+
},
1641+
16301642
/* End-of-list marker */
16311643
{
16321644
{NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy