2 doc/src/sgml/ref/create_access_method.sgml
3 PostgreSQL documentation
6 <refentry id=
"sql-create-access-method">
7 <indexterm zone=
"sql-create-access-method">
8 <primary>CREATE ACCESS METHOD
</primary>
12 <refentrytitle>CREATE ACCESS METHOD
</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
18 <refname>CREATE ACCESS METHOD
</refname>
19 <refpurpose>define a new access method
</refpurpose>
24 CREATE ACCESS METHOD
<replaceable class=
"parameter">name
</replaceable>
25 TYPE
<replaceable class=
"parameter">access_method_type
</replaceable>
26 HANDLER
<replaceable class=
"parameter">handler_function
</replaceable>
31 <title>Description
</title>
34 <command>CREATE ACCESS METHOD
</command> creates a new access method.
38 The access method name must be unique within the database.
42 Only superusers can define new access methods.
47 <title>Parameters
</title>
51 <term><replaceable class=
"parameter">name
</replaceable></term>
54 The name of the access method to be created.
60 <term><replaceable class=
"parameter">access_method_type
</replaceable></term>
63 This clause specifies the type of access method to define.
64 Only
<literal>TABLE
</literal> and
<literal>INDEX
</literal>
65 are supported at present.
71 <term><replaceable class=
"parameter">handler_function
</replaceable></term>
74 <replaceable class=
"parameter">handler_function
</replaceable> is the
75 name (possibly schema-qualified) of a previously registered function
76 that represents the access method. The handler function must be
77 declared to take a single argument of type
<type>internal
</type>,
78 and its return type depends on the type of access method;
79 for
<literal>TABLE
</literal> access methods, it must
80 be
<type>table_am_handler
</type> and for
<literal>INDEX
</literal>
81 access methods, it must be
<type>index_am_handler
</type>.
82 The C-level API that the handler function must implement varies
83 depending on the type of access method. The table access method API
84 is described in
<xref linkend=
"tableam"/> and the index access method
85 API is described in
<xref linkend=
"indexam"/>.
93 <title>Examples
</title>
96 Create an index access method
<literal>heptree
</literal> with
97 handler function
<literal>heptree_handler
</literal>:
99 CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler;
100 </programlisting></para>
104 <title>Compatibility
</title>
107 <command>CREATE ACCESS METHOD
</command> is a
108 <productname>PostgreSQL
</productname> extension.
113 <title>See Also
</title>
115 <simplelist type=
"inline">
116 <member><xref linkend=
"sql-drop-access-method"/></member>
117 <member><xref linkend=
"sql-createopclass"/></member>
118 <member><xref linkend=
"sql-createopfamily"/></member>