Skip to content

Commit 03024ca

Browse files
committed
Add PG_VERSION_NUM for use by 3rd party applications wanting to test the
backend version in C using > and < comparisons.
1 parent d2c555e commit 03024ca

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

configure

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,6 +4742,14 @@ fi
47424742

47434743
fi
47444744

4745+
# Supply a numeric version string for use by 3rd party add-ons
4746+
PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/A-Za-z.*$//' |
4747+
$AWK -F'\.' '{printf \"%d%02d%02d\", $1, $2, (NF >= 3) ? $3 : 0}'`"
4748+
4749+
cat >>confdefs.h <<_ACEOF
4750+
#define PG_VERSION_NUM $PG_VERSION_NUM
4751+
_ACEOF
4752+
47454753

47464754
##
47474755
## Libraries

configure.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.450 2006/02/21 06:06:50 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.451 2006/02/28 16:41:21 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -26,7 +26,7 @@ AC_CONFIG_AUX_DIR(config)
2626
AC_PREFIX_DEFAULT(/usr/local/pgsql)
2727
AC_SUBST(configure_args, [$ac_configure_args])
2828

29-
AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version])
29+
AC_DEFINE_UNQUOTED(PG_VERSION, "$PACKAGE_VERSION", [PostgreSQL version as a string])
3030

3131
AC_CANONICAL_HOST
3232

@@ -585,6 +585,10 @@ if test "$with_python" = yes; then
585585
PGAC_CHECK_PYTHON_EMBED_SETUP
586586
fi
587587

588+
# Supply a numeric version string for use by 3rd party add-ons
589+
PG_VERSION_NUM="`echo "$PACKAGE_VERSION" | sed 's/[A-Za-z].*$//' |
590+
$AWK -F'\.' '{printf \"%d%02d%02d\", $1, $2, (NF >= 3) ? $3 : 0}'`"
591+
AC_DEFINE_UNQUOTED(PG_VERSION_NUM, $PG_VERSION_NUM, [PostgreSQL version as a number])
588592

589593
##
590594
## Libraries

src/include/pg_config.h.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,12 @@
547547
(--with-krb-srvnam=NAME) */
548548
#undef PG_KRB_SRVNAM
549549

550-
/* PostgreSQL version */
550+
/* PostgreSQL version as a string */
551551
#undef PG_VERSION
552552

553+
/* PostgreSQL version as a number */
554+
#undef PG_VERSION_NUM
555+
553556
/* A string containing the version number, platform, and C compiler */
554557
#undef PG_VERSION_STR
555558

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