2016-03-24 03:01:35 +01:00
|
|
|
<!--
|
|
|
|
doc/src/sgml/ref/create_access_method.sgml
|
|
|
|
PostgreSQL documentation
|
|
|
|
-->
|
|
|
|
|
|
|
|
<refentry id="sql-create-access-method">
|
|
|
|
<indexterm zone="sql-create-access-method">
|
|
|
|
<primary>CREATE ACCESS METHOD</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
|
|
|
<refmeta>
|
|
|
|
<refentrytitle>CREATE ACCESS METHOD</refentrytitle>
|
|
|
|
<manvolnum>7</manvolnum>
|
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname>CREATE ACCESS METHOD</refname>
|
|
|
|
<refpurpose>define a new access method</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<synopsis>
|
|
|
|
CREATE ACCESS METHOD <replaceable class="parameter">name</replaceable>
|
|
|
|
TYPE <replaceable class="parameter">access_method_type</replaceable>
|
|
|
|
HANDLER <replaceable class="parameter">handler_function</replaceable>
|
|
|
|
</synopsis>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<command>CREATE ACCESS METHOD</command> creates a new access method.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The access method name must be unique within the database.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Only superusers can define new access methods.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Parameters</title>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable class="parameter">name</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The name of the access method to be created.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2016-08-16 17:35:36 +02:00
|
|
|
<term><replaceable class="parameter">access_method_type</replaceable></term>
|
2016-03-24 03:01:35 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2016-08-16 17:35:36 +02:00
|
|
|
This clause specifies the type of access method to define.
|
2016-03-24 03:01:35 +01:00
|
|
|
Only <literal>INDEX</literal> is supported at present.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2016-08-16 17:35:36 +02:00
|
|
|
<term><replaceable class="parameter">handler_function</replaceable></term>
|
2016-03-24 03:01:35 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2016-08-16 17:35:36 +02:00
|
|
|
<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
|
2017-10-09 03:44:17 +02:00
|
|
|
declared to take a single argument of type <type>internal</type>,
|
2016-08-16 17:35:36 +02:00
|
|
|
and its return type depends on the type of access method;
|
|
|
|
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 index access method API is described in <xref linkend="indexam">.
|
2016-03-24 03:01:35 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Examples</title>
|
|
|
|
|
|
|
|
<para>
|
2017-10-09 03:44:17 +02:00
|
|
|
Create an index access method <literal>heptree</literal> with
|
|
|
|
handler function <literal>heptree_handler</literal>:
|
2016-03-24 03:01:35 +01:00
|
|
|
<programlisting>
|
|
|
|
CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler;
|
2017-06-14 19:55:43 +02:00
|
|
|
</programlisting></para>
|
2016-03-24 03:01:35 +01:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<command>CREATE ACCESS METHOD</command> is a
|
2017-10-09 03:44:17 +02:00
|
|
|
<productname>PostgreSQL</productname> extension.
|
2016-03-24 03:01:35 +01:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
|
|
|
<member><xref linkend="sql-drop-access-method"></member>
|
|
|
|
<member><xref linkend="sql-createopclass"></member>
|
|
|
|
<member><xref linkend="sql-createopfamily"></member>
|
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|