This topic describes how to update the plug-ins of Ganos. The plug-ins of GanosBase include the plug-ins of Ganos and the plug-ins of PostGIS.
Update the plug-ins of Ganos
Each plug-in of Ganos is identified by the word Ganos in the description of the plug-in. To find and update the plug-ins of Ganos that you installed, perform the following steps:
- Use the PostgreSQL CLI to connect to your RDS instance.
- Run the
\dx
command to view all plug-ins that you installed.The following or similar command output is displayed:List of installed extensions Name | Version | Schema | Description ------------------------------------+---------+------------+--------------------------------------------------------------------------------------------------------------------- address_standardizer | 2.5.4 | public | Ganos PostGIS+ address standardizer address_standardizer_data_us | 2.5.4 | public | Ganos PostGIS+ address standardizer data us ganos_address_standardizer | 4.1 | public | Used to parse an address into constituent elements. Generally used to support geocoding address normalization step. ganos_address_standardizer_data_us | 4.1 | public | Address Standardizer US dataset example ganos_geometry | 4.1 | public | Ganos geometry extension for PostgreSQL ganos_geometry_sfcgal | 4.1 | public | Ganos geometry SFCGAL functions extension for PostgreSQL ganos_geometry_topology | 4.1 | topology | Ganos geometry topology spatial types and functions extension for PostgreSQL ganos_networking | 4.1 | public | Ganos networking extension for PostgreSQL ganos_spatialref | 4.1 | public | Ganos spatial reference extension for PostgreSQL ganos_tiger_geocoder | 4.1 | tiger | Ganos tiger geocoder and reverse geocoder plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language postgis | 2.5.4 | public | Ganos PostGIS+ postgis_sfcgal | 2.5.4 | public | Ganos PostGIS+ postgis_tiger_geocoder | 2.5.4 | public | Ganos PostGIS+ tiger geocoder postgis_topology | 2.5.4 | public | Ganos PostGIS+ topology
- View the information about each plug-in in the Description column of the command output to find the plug-ins of Ganos. Note If the description of a plug-in includes the word Ganos, the plug-in is a plug-in of Ganos.
- Update the plug-ins of Ganos.
- If the versions of the plug-ins of Ganos are 3.1 or later, execute the following statement to update all plug-ins of Ganos:
SELECT ganos_update();
- If the versions of the plug-ins of Ganos are earlier than 3.1, create a function to update all plug-ins of Ganos. The following code snippet is an example:
CREATE OR REPLACE FUNCTION ganos_update() RETURNS text AS $$ DECLARE rec RECORD; sql text; BEGIN FOR rec IN SELECT extname FROM pg_extension WHERE extname like 'ganos_%' LOOP sql = 'ALTER EXTENSION ' || rec.extname || ' UPDATE '; RAISE NOTICE '%', sql; EXECUTE sql; END LOOP; return 'All Ganos extensions have updated to latest version'; END $$ LANGUAGE 'plpgsql' volatile STRICT;
- If the versions of the plug-ins of Ganos are 3.1 or later, execute the following statement to update all plug-ins of Ganos:
Update the plug-ins of PostGIS
The method of updating the plug-ins of PostGIS varies based on the major engine version of your RDS instance.
- If the major engine version is PostgreSQL 10, PostgreSQL 11, PostgreSQL 14, or PostgreSQL 15 execute the following statement to update a plug-in of PostGIS:
ALTER EXTENSION <Plug-in name> UPDATE;
- If the major engine version is PostgreSQL 12 or PostgreSQL 13, execute the following statement to update a plug-in of PostGIS:
CREATE OR REPLACE FUNCTION postgis_update() RETURNS void AS $$ DECLARE rec RECORD; sql text; BEGIN FOR rec IN SELECT extname FROM pg_extension WHERE extname like 'postgis%' OR extname like 'address_standardizer%' OR extname like 'pgrouting%' LOOP sql = 'ALTER EXTENSION ' || rec.extname || ' UPDATE '; RAISE NOTICE '%', sql; BEGIN EXECUTE sql; EXCEPTION WHEN OTHERS THEN RAISE NOTICE 'Failed to update extension : %', rec.extname; END; END LOOP; END $$ LANGUAGE 'plpgsql' volatile STRICT; CREATE OR REPLACE FUNCTION update_postgis() RETURNS text AS $$ DECLARE with_pgis boolean; with_ganos boolean; BEGIN select ((select 1 from pg_extension where extname='postgis') is not null) into with_pgis; select ((select 1 from pg_extension where extname='ganos_geometry') is not null) into with_ganos; IF with_pgis and with_ganos THEN PERFORM ganos_update(); ELSIF with_ganos THEN PERFORM ganos_update(); ELSIF with_pgis THEN PERFORM postgis_update(); END IF; return 'PostGIS has update to ' || postgis_lib_version(); END $$ LANGUAGE 'plpgsql' volatile STRICT; SELECT update_postgis();