contribモジュールのインストール方法

#目的
PostgreSQLのcontribモジュールをインストール

#コマンド

空き領域マップ（FreeSpaceMap）を確認する関数「pg_freespace」を利用するとエラー
→利用するためには[pg_freespacemapモジュール](https://www.postgresql.jp/document/12/html/pgfreespacemap.html)のインストールが必要

```
postgres=# select * from pg_freespace('t1');
ERROR:  function pg_freespace(unknown) does not exist
行 1: select * from pg_freespace('t1');
                    ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
```

create extension でモジュールをインストール
>create extension モジュール名;

```
postgres=# create extension pg_freespacemap;
CREATE EXTENSION
```

再度pg_freespace関数を実行！

```
postgres=# select * from pg_freespace('t1');
 blkno | avail
-------+-------
     0 |     0
     1 |    32
     2 |    32
     3 |    32
     4 |    32
     5 |    32
     6 |    32
     7 |    32
     8 |    32
     9 |    32
    10 |    32
    11 |    32
    12 |    32
    13 |    32
    14 |    32
    15 |    32
```

##インストールされているモジュールを確認
pg_available_extensions

```
postgres=# select * from pg_available_extensions;
        name         | default_version | installed_version |                                comment
---------------------+-----------------+-------------------+------------------------------------------------------------------------
 adminpack           | 2.1             | 2.1               | administrative functions for PostgreSQL
 amcheck             | 1.2             |                   | functions for verifying relation integrity
 autoinc             | 1.0             |                   | functions for autoincrementing fields
 bloom               | 1.0             |                   | bloom access method - signature file based index
 bool_plperl         | 1.0             |                   | transform between bool and plperl
 bool_plperlu        | 1.0             |                   | transform between bool and plperlu
 btree_gin           | 1.3             |                   | support for indexing common datatypes in GIN
 btree_gist          | 1.5             |                   | support for indexing common datatypes in GiST
 citext              | 1.6             |                   | data type for case-insensitive character strings
 cube                | 1.4             |                   | data type for multidimensional cubes
 dblink              | 1.2             |                   | connect to other PostgreSQL databases from within a database
 dict_int            | 1.0             |                   | text search dictionary template for integers
 dict_xsyn           | 1.0             |                   | text search dictionary template for extended synonym processing
 dummy_index_am      | 1.0             |                   | dummy_index_am - index access method template
 earthdistance       | 1.1             |                   | calculate great-circle distances on the surface of the Earth
 file_fdw            | 1.0             |                   | foreign-data wrapper for flat file access
 hstore_plperl       | 1.0             |                   | transform between hstore and plperl
 hstore_plperlu      | 1.0             |                   | transform between hstore and plperlu
 hstore_plpython2u   | 1.0             |                   | transform between hstore and plpython2u
 hstore_plpython3u   | 1.0             |                   | transform between hstore and plpython3u
 hstore_plpythonu    | 1.0             |                   | transform between hstore and plpythonu
 insert_username     | 1.0             |                   | functions for tracking who changed a table
 intagg              | 1.1             |                   | integer aggregator and enumerator (obsolete)
 jsonb_plperl        | 1.0             |                   | transform between jsonb and plperl
 jsonb_plperlu       | 1.0             |                   | transform between jsonb and plperlu
 jsonb_plpython2u    | 1.0             |                   | transform between jsonb and plpython2u
 jsonb_plpython3u    | 1.0             |                   | transform between jsonb and plpython3u
 jsonb_plpythonu     | 1.0             |                   | transform between jsonb and plpythonu
 lo                  | 1.1             |                   | Large Object maintenance
 ltree_plpython2u    | 1.0             |                   | transform between ltree and plpython2u
 ltree_plpython3u    | 1.0             |                   | transform between ltree and plpython3u
 ltree_plpythonu     | 1.0             |                   | transform between ltree and plpythonu
 moddatetime         | 1.0             |                   | functions for tracking last modification time
 pgcrypto            | 1.3             |                   | cryptographic functions
 pgrowlocks          | 1.2             |                   | show row-level locking information
 pgstattuple         | 1.5             |                   | show tuple-level statistics
 pg_buffercache      | 1.3             |                   | examine the shared buffer cache
 pg_freespacemap     | 1.2             | 1.2               | examine the free space map (FSM)
 pg_prewarm          | 1.2             |                   | prewarm relation data
 plperl              | 1.0             |                   | PL/Perl procedural language
 plperlu             | 1.0             |                   | PL/PerlU untrusted procedural language
 plpgsql             | 1.0             | 1.0               | PL/pgSQL procedural language
 plpython2u          | 1.0             |                   | PL/Python2U untrusted procedural language
 plpython3u          | 1.0             |                   | PL/Python3U untrusted procedural language
 plpythonu           | 1.0             |                   | PL/PythonU untrusted procedural language
 pltcl               | 1.0             |                   | PL/Tcl procedural language
 pltclu              | 1.0             |                   | PL/TclU untrusted procedural language
 sslinfo             | 1.2             |                   | information about SSL certificates
 system_stats        | 1.0             |                   | EnterpriseDB system statistics for PostgreSQL
 tcn                 | 1.0             |                   | Triggered change notifications
 test_bloomfilter    | 1.0             |                   | Test code for Bloom filter library
 test_ext1           | 1.0             |                   | Test extension 1
 test_ext2           | 1.0             |                   | Test extension 2
 test_ext3           | 1.0             |                   | Test extension 3
 test_ext4           | 1.0             |                   | Test extension 4
 test_ext5           | 1.0             |                   | Test extension 5
 test_ext6           | 1.0             |                   | test_ext6
 test_ext7           | 1.0             |                   | Test extension 7
 test_ext8           | 1.0             |                   | Test extension 8
 test_ext_cyclic1    | 1.0             |                   | Test extension cyclic 1
 test_ext_cyclic2    | 1.0             |                   | Test extension cyclic 2
 test_ext_evttrig    | 1.0             |                   | Test extension - event trigger
 test_ginpostinglist | 1.0             |                   | Test code for ginpostinglist.c
 test_integerset     | 1.0             |                   | Test code for integerset
 test_pg_dump        | 1.0             |                   | Test pg_dump with an extension
 test_predtest       | 1.0             |                   | Test code for optimizer/util/predtest.c
 test_rbtree         | 1.0             |                   | Test code for red-black tree library
 unaccent            | 1.1             |                   | text search dictionary that removes accents
 xml2                | 1.1             |                   | XPath querying and XSLT
(86 行)
```

#参考
[PostgreSQL 12.4文書](https://www.postgresql.jp/document/12/html/index.html)
[付録F 追加で提供されるモジュール](https://www.postgresql.jp/document/12/html/contrib.html)