Opened 13 months ago

Last modified 11 months ago

#5584 closed defect

PostGIS Upgrade Issue — at Version 7

Reported by: rama Owned by: strk
Priority: critical Milestone: PostGIS Packaging
Component: upgrade/soft Version: 3.3.x
Keywords: windows Cc: rama

Description (last modified by rama)

I am facing an issue with PostGIS Upgrade from 2.5.0 to 3.3.3. Please check and help me out to fix the issue.

Environment Details

Os: Windows Environment (Windows 2016)
Postgresql Version: 11
Postgis Upgrade from 2.5.0 to 3.3.3
Download and installation done from stack builder

Current Version of Database and Postgis

  DATABASE_VERSION                      
------------------------------------------------------------
 PostgreSQL 11.0, compiled by Visual C++ build 1914, 64-bit
(1 row)
POSTGIS_VERSION                                                                                                                      
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.5.0 r16836" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0 3.7.0" SFCGAL="1.3.2" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released 2018/03/19 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="0.12" LIBPROTOBUF="1.2.1" TOPOLOGY RASTER
(1 row)

Command Execution Details

ALTER EXTENSION postgis UPDATE TO "3.3.3";
SELECT postgis_extensions_upgrade();

ERROR message:

ALTER EXTENSION postgis UPDATE TO "3.3.3";
WARNING:  unpackaging raster
WARNING:  PostGIS Raster functionality has been unpackaged
HINT:  type `SELECT postgis_extensions_upgrade();` to finish the upgrade. After upgrading, if you want to drop raster, run: DROP EXTENSION postgis_raster;
ERROR:  could not load library "R:/Database/11/lib/postgis-3.dll": The specified procedure could not be found.


 SELECT postgis_extensions_upgrade();
WARNING:  unpackaging raster
WARNING:  PostGIS Raster functionality has been unpackaged
HINT:  type `SELECT postgis_extensions_upgrade();` to finish the upgrade. After upgrading, if you want to drop raster, run: DROP EXTENSION postgis_raster;

ERROR:  could not load library "R:/Database/11/lib/postgis-3.dll": The specified procedure could not be found.

CONTEXT:  SQL statement "ALTER EXTENSION postgis UPDATE TO "3.3.3";"
PL/pgSQL function postgis_extensions_upgrade() line 22 at EXECUTE
SQL state: XX000

Change History (8)

comment:1 by rama, 13 months ago

Component: postgisbuild/upgrade/install
Milestone: PostGIS PostgreSQLPostGIS Packaging
Owner: changed from pramsey to strk
Priority: highcritical

comment:2 by rama, 13 months ago

Description: modified (diff)

comment:3 by rama, 13 months ago

Description: modified (diff)

by rama, 13 months ago

Upgrade command referred from Manual

comment:4 by rama, 13 months ago

SELECT postgis_extensions_upgrade();

Error Message

WARNING:  unpackaging raster
WARNING:  PostGIS Raster functionality has been unpackaged
HINT:  type `SELECT postgis_extensions_upgrade();` to finish the upgrade. After upgrading, if you want to drop raster, run: DROP EXTENSION postgis_raster;

ERROR:  could not load library "R:/Database/11/lib/postgis-3.dll": The specified procedure could not be found.

CONTEXT:  SQL statement "ALTER EXTENSION postgis UPDATE TO "3.3.3";"
PL/pgSQL function postgis_extensions_upgrade() line 22 at EXECUTE
SQL state: XX000

comment:5 by rama, 13 months ago

ALTER EXTENSION postgis UPDATE; [without version]

Error Message

WARNING:  unpackaging raster
WARNING:  PostGIS Raster functionality has been unpackaged
HINT:  type `SELECT postgis_extensions_upgrade();` to finish the upgrade. After upgrading, if you want to drop raster, run: DROP EXTENSION postgis_raster;

ERROR:  could not load library "R:/Database/11/lib/postgis-3.dll": The specified procedure could not be found.

SQL state: XX000

comment:6 by rama, 13 months ago

Function:postgis_extensions_upgrade

-- FUNCTION: public.postgis_extensions_upgrade()

-- DROP FUNCTION IF EXISTS public.postgis_extensions_upgrade();

CREATE OR REPLACE FUNCTION public.postgis_extensions_upgrade(
	)
    RETURNS text
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE PARALLEL UNSAFE
AS $BODY$
DECLARE rec record; sql text;
BEGIN
	-- if at a version different from default version or we are at a dev version,
	-- then do an upgrade to default version

	FOR rec in SELECT  name, default_version, installed_version
		FROM pg_available_extensions
		WHERE installed_version > '' AND name IN('postgis', 'postgis_sfcgal', 'postgis_tiger_geocoder', 'postgis_topology')
		AND ( default_version <> installed_version  OR
			( default_version = installed_version AND default_version ILIKE '%dev%' AND  installed_version ILIKE '%dev%'  )  ) LOOP

		-- we need to upgrade to next so our installed is different from current
		-- and then we can upgrade to default_version
		IF rec.installed_version = rec.default_version THEN
			sql = 'ALTER EXTENSION ' || rec.name || ' UPDATE TO ' || quote_ident(rec.default_version || 'next')   || ';';
			EXECUTE sql;
			RAISE NOTICE '%', sql;
		END IF;

		sql = 'ALTER EXTENSION ' || rec.name || ' UPDATE TO ' || quote_ident(rec.default_version)   || ';';
		EXECUTE sql;
		RAISE NOTICE '%', sql;
	END LOOP;

	RETURN public.postgis_full_version();

END
$BODY$;

ALTER FUNCTION public.postgis_extensions_upgrade()
    OWNER TO postgres;

COMMENT ON FUNCTION public.postgis_extensions_upgrade()
    IS 'Upgrades installed postgis packaged extensions (e.g. postgis_sfcgal, postgis_topology, postgis_sfcgal) to latest installed version. Reports full postgis version and build configuration infos after.';

Output of FOR loop select Query

name|default_version|installed_version
"postgis"|"3.3.3"|"2.5.0"

Last edited 13 months ago by rama (previous) (diff)

comment:7 by rama, 13 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.