Ganos插件是阿里云自研的时空数据库,提供一系列的数据类型、函数和存储过程,本文介绍Ganos插件的升级方法。

阿里云时空数据库Ganos插件在描述中进行标识。您可以通过如下方法快速找到已安装的Ganos插件并升级。
  1. 使用PostgreSQL命令行工具连接数据库。
  2. 使用\dx命令查看插件列表。
    结果示例:
                                                                              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
                            
  3. 通过Description列的描述信息获取已安装的Ganos插件。
    说明 如果描述中包含Ganos,则表示是Ganos插件。
  4. 升级Ganos插件。
    • 如果您的Ganos插件版本大于等于3.1,请使用如下语句对全部Ganos插件进行升级。
      SELECT ganos_update();
    • 如果您的Ganos插件版本小于3.1,请参考如下命令,手动创建函数对全部Ganos插件进行升级。
      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;
    说明 Ganos插件与其他插件的升级方式不同,其他插件升级方式如下:
    ALTER EXTENSION <插件名> UPDATE;