From 385802797b1385c0b19a4ac4735dbd65a3040d76 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Fri, 27 Sep 2013 16:34:21 +0000 Subject: [PATCH] Change deprecation warning to raise a WARNING after 2 version deprecation time I kept the DEBUG for the first deprecating version to keep changes small (no need to change testsuite again) but I really think it should be at least a NOTICE in that case, or nobody would notice. See #2440 git-svn-id: http://svn.osgeo.org/postgis/trunk@11988 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/postgis.sql.in | 17 ++++++++++++++++- postgis/sqldefines.h.in | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/postgis/postgis.sql.in b/postgis/postgis.sql.in index ed96878e3..e2f304ac4 100644 --- a/postgis/postgis.sql.in +++ b/postgis/postgis.sql.in @@ -27,11 +27,26 @@ SET client_min_messages TO warning; BEGIN; +-- Let the user know about a deprecated signature and its new name, if any CREATE OR REPLACE FUNCTION _postgis_deprecate(oldname text, newname text, version text) RETURNS void AS $$ +DECLARE + curver_text text; BEGIN - RAISE DEBUG '% signature was deprecated in %. Please use %', oldname, version, newname; + -- + -- Raises a NOTICE if it was deprecated in this version, + -- a WARNING if in a previous version (only up to minor version checked) + -- + curver_text := POSTGIS_LIB_VERSION; + IF split_part(curver_text,'.',1)::int > split_part(version,'.',1)::int OR + ( split_part(curver_text,'.',1) = split_part(version,'.',1) AND + split_part(curver_text,'.',2) != split_part(version,'.',2) ) + THEN + RAISE WARNING '% signature was deprecated in %. Please use %', oldname, version, newname; + ELSE + RAISE DEBUG '% signature was deprecated in %. Please use %', oldname, version, newname; + END IF; END; $$ LANGUAGE 'plpgsql' IMMUTABLE STRICT; diff --git a/postgis/sqldefines.h.in b/postgis/sqldefines.h.in index 9cb18108f..1235af6bc 100644 --- a/postgis/sqldefines.h.in +++ b/postgis/sqldefines.h.in @@ -9,7 +9,7 @@ #define POSTGIS_PGSQL_VERSION @POSTGIS_PGSQL_VERSION@ #define POSTGIS_GEOS_VERSION @POSTGIS_GEOS_VERSION@ #define POSTGIS_PROJ_VERSION @POSTGIS_PROJ_VERSION@ -#define POSTGIS_LIB_VERSION @POSTGIS_LIB_VERSION@ +#define POSTGIS_LIB_VERSION '@POSTGIS_LIB_VERSION@' #define POSTGIS_LIBXML2_VERSION @POSTGIS_LIBXML2_VERSION@ /* -- 2.50.1