バージョンごとのドキュメント一覧

CREATE ACCESS METHOD

CREATE ACCESS METHOD <refpurpose>define a new access method</refpurpose> — 新しいアクセスメソッドを定義する

概要

CREATE ACCESS METHOD name
    TYPE access_method_type
    HANDLER handler_function

説明

<title>Description</title>

<command>CREATE ACCESS METHOD</command> creates a new access method. CREATE ACCESS METHODは新しいアクセスメソッドを作成します。

The access method name must be unique within the database. アクセスメソッドの名前はデータベース内で一意でなければなりません。

Only superusers can define new access methods. スーパーユーザのみが新しいアクセスメソッドを定義できます。

パラメータ

<title>Parameters</title>
name

The name of the access method to be created. 作成するアクセスメソッドの名前です。

access_method_type

This clause specifies the type of access method to define. Only <literal>TABLE</literal> and <literal>INDEX</literal> are supported at present. この句では定義するアクセスメソッドの型を指定します。 現在のところ、TABLEINDEXだけがサポートされています。

handler_function

<replaceable class="parameter">handler_function</replaceable> is the name (possibly schema-qualified) of a previously registered function that represents the access method. The handler function must be declared to take a single argument of type <type>internal</type>, and its return type depends on the type of access method; for <literal>TABLE</literal> access methods, it must be <type>table_am_handler</type> and for <literal>INDEX</literal> access methods, it must be <type>index_am_handler</type>. The C-level API that the handler function must implement varies depending on the type of access method. The table access method API is described in <xref linkend="tableam"/> and the index access method API is described in <xref linkend="indexam"/>. handler_functionはアクセスメソッドを表す、事前に登録された関数の名前(スキーマ修飾可)です。 ハンドラ関数はinternal型の引数を1つだけ取るものとして定義される必要があります。 戻り値の型はアクセスメソッドの型に依存し、TABLEアクセスメソッドの場合はtable_am_handlerでなければならず、INDEXのアクセスメソッドの場合はindex_am_handlerでなければなりません。 ハンドラ関数が実装しなければならないC言語でのAPIはアクセスメソッドの型によって変わります。 TABLEのアクセスメソッドのAPIについては第63章で、INDEXのアクセスメソッドのAPIについては第64章で説明されています。

<title>Examples</title>

Create an index access method <literal>heptree</literal> with handler function <literal>heptree_handler</literal>: INDEXのアクセスメソッドheptreeをハンドラ関数heptree_handlerで作成するには、次のようにします。

CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler;

互換性

<title>Compatibility</title>

<command>CREATE ACCESS METHOD</command> is a <productname>PostgreSQL</productname> extension. CREATE ACCESS METHODPostgreSQLの拡張です。

関連項目

<title>See Also</title> DROP ACCESS METHOD, CREATE OPERATOR CLASS, CREATE OPERATOR FAMILY