PostgreSQLスキルアップノート(自己啓発のための個人サイト)
拡張(Extension)
【一覧に戻る】
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
■■■■ PostgreSQL スキルアップノート
■■■■
■◆■■ 拡張(Extension)
■■■■
■■■■
■■■■ 2013/02/16
■■■■ 使用環境:PostgreSQL9.1.7 (CentOS6.2)
(C) 2013 ohdb
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【マニュアル】
CREATE EXTENSION→●[マニュアル]
付録 F. 追加で提供されるモジュール→●[マニュアル]
その他→●[マニュアル]
【その他】
→●[記事]
PGXN(PostgreSQL Extension Network)→●[サイト]
【用語等】
マニュアルでは「拡張」で統一されているが、一般には訳さずに「Extension」という場合が多い。
■1■ 概要
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PostgreSQLでは「拡張(Extension)」と呼ばれる管理単位で拡張モジュールのインストールや管理をする。
ベースとなる構文は
CREATE EXTENSION モジュール名;
・データベーススーパーユーザにて実行。
・新しいオブジェクトを登録する作業なので、データベース単位に(またはtemplate1で)行う必要がある。
・通常はpublicにインストールされる。(モジュールによるが)必要に応じてCREATE EXTENSIONコマンドにSCHEMA schema_nameを追加。
・モジュールによってはshared_preload_librariesなども必要。
・削除や変更はDROP EXTENSION、ALTER EXTENSION
・個々のモジュールは詳細のドキュメントを参照のこと。
付録 F. 追加で提供されるモジュール→●[マニュアル]
【参考】拡張「Extension」は9.1からの機能
従来例 psql -d dbname -f $PGHOME/share/contrib/モジュール.sql
9.1以降 CREATE EXTENSION モジュール名;
■2■ インストール可能な拡張/インストール済みの拡張の確認方法
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
利用可能な拡張は pg_available_extensionsで確認できる。
【□】 select * from pg_available_extensions;
installed_version のカラムに値のあるものは既にインストール済みであることを示す。
以下の例で表示の大半は「付録 F. 追加で提供されるモジュール」記載のPostgreSQLが提供するモジュール。
例
postgres@pg91 data]$ psql -d postgres -c "select * from pg_available_extensions"
name | default_version | installed_version | comment
--------------------+-----------------+-------------------+----------------------------------------------------------------------
intarray | 1.0 | | functions, operators, and index support for 1-D arrays of integers
sslinfo | 1.0 | | information about SSL certificates
pageinspect | 1.0 | | inspect the contents of database pages at a low level
pgcrypto | 1.0 | | cryptographic functions
pg_stat_statements | 1.0 | 1.0 | track execution statistics of all SQL statements executed
test_parser | 1.0 | | example of a custom parser for full-text search
insert_username | 1.0 | | functions for tracking who changed a table
pgrowlocks | 1.0 | | show row-level locking information
plpgsql | 1.0 | 1.0 | PL/pgSQL procedural language
unaccent | 1.0 | | text search dictionary that removes accents
citext | 1.0 | | data type for case-insensitive character strings
uuid-ossp | 1.0 | | generate universally unique identifiers (UUIDs)
ltree | 1.0 | | data type for hierarchical tree-like structures
fuzzystrmatch | 1.0 | | determine similarities and distance between strings
hstore | 1.0 | | data type for storing sets of (key, value) pairs
btree_gin | 1.0 | | support for indexing common datatypes in GIN
refint | 1.0 | | functions for implementing referential integrity (obsolete)
pgstattuple | 1.0 | | show tuple-level statistics
timetravel | 1.0 | | functions for implementing time travel
dict_xsyn | 1.0 | | text search dictionary template for extended synonym processing
xml2 | 1.0 | | XPath querying and XSLT
tablefunc | 1.0 | | functions that manipulate whole tables, including crosstab
dict_int | 1.0 | | text search dictionary template for integers
dblink | 1.0 | | connect to other PostgreSQL databases from within a database
lo | 1.0 | | Large Object maintenance
file_fdw | 1.0 | | foreign-data wrapper for flat file access
seg | 1.0 | | data type for representing line segments or floating-point intervals
autoinc | 1.0 | | functions for autoincrementing fields
earthdistance | 1.0 | | calculate great-circle distances on the surface of the Earth
tsearch2 | 1.0 | | compatibility package for pre-8.3 text search functions
btree_gist | 1.0 | | support for indexing common datatypes in GiST
isn | 1.0 | | data types for international product numbering standards
intagg | 1.0 | | integer aggregator and enumerator (obsolete)
adminpack | 1.0 | | administrative functions for PostgreSQL
pg_freespacemap | 1.0 | | examine the free space map (FSM)
cube | 1.0 | | data type for multidimensional cubes
pg_trgm | 1.0 | | text similarity measurement and index searching based on trigrams
chkpass | 1.0 | | data type for auto-encrypted passwords
moddatetime | 1.0 | | functions for tracking last modification time
pg_buffercache | 1.0 | | examine the shared buffer cache
(40 行)
以上