久しぶりにPostgreSQL16を新規にインストールしたら、OSに対し自身で拡張モジュールをインストールしないといけない事になっていました。(昔のバージョンでは、拡張モジュールも一緒に入ってくれたと思ったんですがね、、)
[sooni@vm105 ~]$ cat /etc/redhat-release
Rocky Linux release 9.5 (Blue Onyx)
[sooni@vm105 ~]$ psql -h localhost -U postgres -d postgres
ユーザー postgres のパスワード:
psql (16.8)
"help"でヘルプを表示します。
-- 通常ここには拡張可能なモジュール一覧が出てくるのに出てこない、、
--
postgres=# select * from pg_available_extensions
order by installed_version,name;
name | default_version | installed_version | comment
---------+-----------------+-------------------+------------------------------
plpgsql | 1.0 | 1.0 | PL/pgSQL procedural language
(1 行)
postgres=#
--
-- 無理やりインストールを試みると以下の通り
--
postgres=# create extension pg_stat_statements;
ERROR: 機能拡張"pg_stat_statements" は利用できません
DETAIL: 機能拡張の制御ファイル"/usr/pgsql-16/share/extension/pg_stat_statements.control"をオープンできませんでした: そのようなファイル やディレクトリはありません
HINT: PostgreSQLが稼働しているシステムで、事前に機能拡張がインストールされている必要があります。
postgres=#
postgres=# exit
--
-- 拡張機能のインストール
[sooni@vm105 ~]$ sudo yum install postgresql16-contrib
[sudo] sooni のパスワード:
メタデータの期限切れの最終確認: 0:56:22 前の 2025年04月26日 07時45分03秒 に実施しました。
依存関係が解決しました。
========================================================================================================================================
パッケージ アーキテクチャー バージョン リポジトリー サイズ
========================================================================================================================================
インストール:
postgresql16-contrib x86_64 16.8-1PGDG.rhel9 pgdg16 730 k
トランザクションの概要
========================================================================================================================================
インストール 1 パッケージ
ダウンロードサイズの合計: 730 k
インストール後のサイズ: 2.7 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード:
postgresql16-contrib-16.8-1PGDG.rhel9.x86_64.rpm 1.5 MB/s | 730 kB 00:00
----------------------------------------------------------------------------------------------------------------------------------------
合計 1.5 MB/s | 730 kB 00:00
トランザクションを確認しています
トランザクションの確認に成功しました。
トランザクションをテストしています
トランザクションのテストに成功しました。
トランザクションを実行しています
準備中 : 1/1
インストール中 : postgresql16-contrib-16.8-1PGDG.rhel9.x86_64 1/1
scriptletの実行中: postgresql16-contrib-16.8-1PGDG.rhel9.x86_64 1/1
検証中 : postgresql16-contrib-16.8-1PGDG.rhel9.x86_64 1/1
インストール済み:
postgresql16-contrib-16.8-1PGDG.rhel9.x86_64
完了しました!
[sooni@vm105 ~]$
OSに拡張モジュール
sudo yum install postgresql16-contrib
-- 再度確認したらこの通り(PostgreSQLの再起動も不要)
--
postgres=# select * from pg_available_extensions
order by installed_version,name;
name | default_version | installed_version | comment
--------------------+-----------------+-------------------+------------------------------------------------------------------------
plpgsql | 1.0 | 1.0 | PL/pgSQL procedural language
adminpack | 2.1 | | administrative functions for PostgreSQL
amcheck | 1.3 | | functions for verifying relation integrity
autoinc | 1.0 | | functions for autoincrementing fields
bloom | 1.0 | | bloom access method - signature file based index
btree_gin | 1.3 | | support for indexing common datatypes in GIN
btree_gist | 1.7 | | support for indexing common datatypes in GiST
citext | 1.6 | | data type for case-insensitive character strings
cube | 1.5 | | 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
earthdistance | 1.2 | | calculate great-circle distances on the surface of the Earth
file_fdw | 1.0 | | foreign-data wrapper for flat file access
fuzzystrmatch | 1.2 | | determine similarities and distance between strings
hstore | 1.8 | | data type for storing sets of (key, value) pairs
hstore_plperl | 1.0 | | transform between hstore and plperl
hstore_plperlu | 1.0 | | transform between hstore and plperlu
insert_username | 1.0 | | functions for tracking who changed a table
intagg | 1.1 | | integer aggregator and enumerator (obsolete)
intarray | 1.5 | | functions, operators, and index support for 1-D arrays of integers
isn | 1.2 | | data types for international product numbering standards
jsonb_plperl | 1.0 | | transform between jsonb and plperl
jsonb_plperlu | 1.0 | | transform between jsonb and plperlu
lo | 1.1 | | Large Object maintenance
ltree | 1.2 | | data type for hierarchical tree-like structures
moddatetime | 1.0 | | functions for tracking last modification time
old_snapshot | 1.0 | | utilities in support of old_snapshot_threshold
pageinspect | 1.12 | | inspect the contents of database pages at a low level
pg_buffercache | 1.4 | | examine the shared buffer cache
pg_freespacemap | 1.2 | | examine the free space map (FSM)
pg_prewarm | 1.2 | | prewarm relation data
pg_stat_statements | 1.10 | | track planning and execution statistics of all SQL statements executed
pg_surgery | 1.0 | | extension to perform surgery on a damaged relation
pg_trgm | 1.6 | | text similarity measurement and index searching based on trigrams
pg_visibility | 1.2 | | examine the visibility map (VM) and page-level visibility info
pg_walinspect | 1.1 | | functions to inspect contents of PostgreSQL Write-Ahead Log
pgcrypto | 1.3 | | cryptographic functions
pgrowlocks | 1.2 | | show row-level locking information
pgstattuple | 1.5 | | show tuple-level statistics
postgres_fdw | 1.1 | | foreign-data wrapper for remote PostgreSQL servers
refint | 1.0 | | functions for implementing referential integrity (obsolete)
seg | 1.4 | | data type for representing line segments or floating-point intervals
sslinfo | 1.2 | | information about SSL certificates
tablefunc | 1.0 | | functions that manipulate whole tables, including crosstab
tcn | 1.0 | | Triggered change notifications
tsm_system_rows | 1.0 | | TABLESAMPLE method which accepts number of rows as a limit
tsm_system_time | 1.0 | | TABLESAMPLE method which accepts time in milliseconds as a limit
unaccent | 1.1 | | text search dictionary that removes accents
uuid-ossp | 1.1 | | generate universally unique identifiers (UUIDs)
xml2 | 1.1 | | XPath querying and XSLT
(51 行)
postgres=#
-- 無事拡張モジュールを追加できました。
--
postgres=# create extension pg_stat_statements;
CREATE EXTENSION
postgres=#