Commit 4427dbff authored by Sandro Santilli's avatar Sandro Santilli

Add check for liblwgeom version mismatch in postgis_full_version()

Adds a postgis_liblwgeom_version() function accessible to SQL.

git-svn-id: http://svn.osgeo.org/postgis/trunk@14171 b70326c6-7e19-0410-871a-916f4a2858ee
parent f9c6a422
Pipeline #160919 skipped
...@@ -23,6 +23,8 @@ SHELL = @SHELL@ ...@@ -23,6 +23,8 @@ SHELL = @SHELL@
INSTALL = $(SHELL) ../install-sh INSTALL = $(SHELL) ../install-sh
LIBTOOL = @LIBTOOL@ LIBTOOL = @LIBTOOL@
SOVER = @POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@
IFACE_CURRENT = @LIBLWGEOM_CURRENT@ IFACE_CURRENT = @LIBLWGEOM_CURRENT@
IFACE_AGE = @LIBLWGEOM_AGE@ IFACE_AGE = @LIBLWGEOM_AGE@
IFACE_REV = @LIBLWGEOM_REV@ IFACE_REV = @LIBLWGEOM_REV@
...@@ -162,7 +164,7 @@ $(LT_OBJS): ../postgis_config.h ../postgis_svn_revision.h $(SA_HEADERS) ...@@ -162,7 +164,7 @@ $(LT_OBJS): ../postgis_config.h ../postgis_svn_revision.h $(SA_HEADERS)
liblwgeom.la: $(LT_OBJS) liblwgeom.la: $(LT_OBJS)
$(LIBTOOL) --tag=CC --mode=link $(CC) -rpath $(libdir) $(LT_OBJS) \ $(LIBTOOL) --tag=CC --mode=link $(CC) -rpath $(libdir) $(LT_OBJS) \
-version-info $(VERSION_INFO) $(LDFLAGS) -o $@ -release $(SOVER) -version-info $(VERSION_INFO) $(LDFLAGS) -o $@
maintainer-clean: clean maintainer-clean: clean
rm -f lwin_wkt_lex.c rm -f lwin_wkt_lex.c
......
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
#define LIBLWGEOM_VERSION_MINOR "@POSTGIS_MINOR_VERSION@" #define LIBLWGEOM_VERSION_MINOR "@POSTGIS_MINOR_VERSION@"
#define LIBLWGEOM_GEOS_VERSION "@POSTGIS_GEOS_VERSION@" #define LIBLWGEOM_GEOS_VERSION "@POSTGIS_GEOS_VERSION@"
/** Return lwgeom version string (not to be freed) */
const char* lwgeom_version(void);
/** /**
* Return types for functions with status returns. * Return types for functions with status returns.
*/ */
......
...@@ -17,12 +17,27 @@ ...@@ -17,12 +17,27 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include "../postgis_svn_revision.h"
/* /*
* Lower this to reduce integrity checks * Lower this to reduce integrity checks
*/ */
#define PARANOIA_LEVEL 1 #define PARANOIA_LEVEL 1
const char *
lwgeom_version()
{
static char *ptr = NULL;
static char buf[256];
if ( ! ptr )
{
ptr = buf;
snprintf(ptr, 256, LIBLWGEOM_VERSION" r%d", POSTGIS_SVN_REVISION);
}
return ptr;
}
/********************************************************************** /**********************************************************************
* BOX routines * BOX routines
......
...@@ -34,6 +34,7 @@ Datum postgis_uses_stats(PG_FUNCTION_ARGS); ...@@ -34,6 +34,7 @@ Datum postgis_uses_stats(PG_FUNCTION_ARGS);
Datum postgis_autocache_bbox(PG_FUNCTION_ARGS); Datum postgis_autocache_bbox(PG_FUNCTION_ARGS);
Datum postgis_scripts_released(PG_FUNCTION_ARGS); Datum postgis_scripts_released(PG_FUNCTION_ARGS);
Datum postgis_version(PG_FUNCTION_ARGS); Datum postgis_version(PG_FUNCTION_ARGS);
Datum postgis_liblwgeom_version(PG_FUNCTION_ARGS);
Datum postgis_lib_version(PG_FUNCTION_ARGS); Datum postgis_lib_version(PG_FUNCTION_ARGS);
Datum postgis_svn_version(PG_FUNCTION_ARGS); Datum postgis_svn_version(PG_FUNCTION_ARGS);
Datum postgis_libxml_version(PG_FUNCTION_ARGS); Datum postgis_libxml_version(PG_FUNCTION_ARGS);
...@@ -138,6 +139,14 @@ Datum postgis_version(PG_FUNCTION_ARGS) ...@@ -138,6 +139,14 @@ Datum postgis_version(PG_FUNCTION_ARGS)
PG_RETURN_TEXT_P(result); PG_RETURN_TEXT_P(result);
} }
PG_FUNCTION_INFO_V1(postgis_liblwgeom_version);
Datum postgis_liblwgeom_version(PG_FUNCTION_ARGS)
{
const char *ver = lwgeom_version();
text *result = cstring2text(ver);
PG_RETURN_TEXT_P(result);
}
PG_FUNCTION_INFO_V1(postgis_lib_version); PG_FUNCTION_INFO_V1(postgis_lib_version);
Datum postgis_lib_version(PG_FUNCTION_ARGS) Datum postgis_lib_version(PG_FUNCTION_ARGS)
{ {
......
...@@ -2683,6 +2683,10 @@ CREATE OR REPLACE FUNCTION postgis_version() RETURNS text ...@@ -2683,6 +2683,10 @@ CREATE OR REPLACE FUNCTION postgis_version() RETURNS text
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE 'c' IMMUTABLE; LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_liblwgeom_version() RETURNS text
AS 'MODULE_PATHNAME'
LANGUAGE 'c' IMMUTABLE;
CREATE OR REPLACE FUNCTION postgis_proj_version() RETURNS text CREATE OR REPLACE FUNCTION postgis_proj_version() RETURNS text
AS 'MODULE_PATHNAME' AS 'MODULE_PATHNAME'
LANGUAGE 'c' IMMUTABLE; LANGUAGE 'c' IMMUTABLE;
...@@ -2738,6 +2742,7 @@ DECLARE ...@@ -2738,6 +2742,7 @@ DECLARE
cgalver text; cgalver text;
gdalver text; gdalver text;
libxmlver text; libxmlver text;
liblwgeomver text;
dbproc text; dbproc text;
relproc text; relproc text;
fullver text; fullver text;
...@@ -2771,6 +2776,7 @@ BEGIN ...@@ -2771,6 +2776,7 @@ BEGIN
WHEN undefined_function THEN WHEN undefined_function THEN
sfcgalver := NULL; sfcgalver := NULL;
END; END;
SELECT postgis_liblwgeom_version() INTO liblwgeomver;
SELECT postgis_libxml_version() INTO libxmlver; SELECT postgis_libxml_version() INTO libxmlver;
SELECT postgis_scripts_installed() INTO dbproc; SELECT postgis_scripts_installed() INTO dbproc;
SELECT postgis_scripts_released() INTO relproc; SELECT postgis_scripts_released() INTO relproc;
...@@ -2811,6 +2817,11 @@ BEGIN ...@@ -2811,6 +2817,11 @@ BEGIN
fullver = fullver || '"'; fullver = fullver || '"';
IF liblwgeomver != relproc THEN
fullver = fullver || ' (liblwgeom version mismatch: "' || liblwgeomver || '")';
END IF;
IF geosver IS NOT NULL THEN IF geosver IS NOT NULL THEN
fullver = fullver || ' GEOS="' || geosver || '"'; fullver = fullver || ' GEOS="' || geosver || '"';
END IF; END IF;
......
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