LoginSignup
5
4

More than 5 years have passed since last update.

【PostGIS】インストールされているPostGISのバージョンを確認

Posted at

SQLで確認

以下のSQLを実行すればOK。

SELECT postgis_version();
出力
            postgis_version
---------------------------------------
 2.1 USE_GEOS=1 USE_PROJ=1 USE_STATS=1

この場合、バージョン2.1がインストールされている。

エラーが出る場合

以下のようなエラーが出力される場合は、PostGISがインストールされていないか、接続しているDBでPostGIS EXTENSIONが有効となっていない。

ERROR:  function postgis_version() does not exist
LINE 1: SELECT postgis_version();

psqlのコマンドで確認

\dxと入力してEnterキーで、有効化されているEXTENSIONの一覧が表示される。そこで確認できる。

postgres=# \dx
                                       インストール済みの拡張の一覧
   名前    | バージョン |  スキーマ  |                                説明
-----------+------------+------------+---------------------------------------------------------------------
 adminpack | 1.0        | pg_catalog | administrative functions for PostgreSQL
 plpgsql   | 1.0        | pg_catalog | PL/pgSQL procedural language
 postgis   | 2.1.3      | public     | PostGIS geometry, geography, and raster spatial types and functions
(3 行)

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4