|
| 1 | +<!-- |
| 2 | +doc/src/sgml/ref/create_access_method.sgml |
| 3 | +PostgreSQL documentation |
| 4 | +--> |
| 5 | + |
| 6 | +<refentry id="sql-create-access-method"> |
| 7 | + <indexterm zone="sql-create-access-method"> |
| 8 | + <primary>CREATE ACCESS METHOD</primary> |
| 9 | + </indexterm> |
| 10 | + |
| 11 | + <refmeta> |
| 12 | + <refentrytitle>CREATE ACCESS METHOD</refentrytitle> |
| 13 | + <manvolnum>7</manvolnum> |
| 14 | + <refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 | + </refmeta> |
| 16 | + |
| 17 | + <refnamediv> |
| 18 | + <refname>CREATE ACCESS METHOD</refname> |
| 19 | + <refpurpose>define a new access method</refpurpose> |
| 20 | + </refnamediv> |
| 21 | + |
| 22 | + <refsynopsisdiv> |
| 23 | +<synopsis> |
| 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> |
| 27 | +</synopsis> |
| 28 | + </refsynopsisdiv> |
| 29 | + |
| 30 | + <refsect1> |
| 31 | + <title>Description</title> |
| 32 | + |
| 33 | + <para> |
| 34 | + <command>CREATE ACCESS METHOD</command> creates a new access method. |
| 35 | + </para> |
| 36 | + |
| 37 | + <para> |
| 38 | + The access method name must be unique within the database. |
| 39 | + </para> |
| 40 | + |
| 41 | + <para> |
| 42 | + Only superusers can define new access methods. |
| 43 | + </para> |
| 44 | + </refsect1> |
| 45 | + |
| 46 | + <refsect1> |
| 47 | + <title>Parameters</title> |
| 48 | + |
| 49 | + <variablelist> |
| 50 | + <varlistentry> |
| 51 | + <term><replaceable class="parameter">name</replaceable></term> |
| 52 | + <listitem> |
| 53 | + <para> |
| 54 | + The name of the access method to be created. |
| 55 | + </para> |
| 56 | + </listitem> |
| 57 | + </varlistentry> |
| 58 | + |
| 59 | + <varlistentry> |
| 60 | + <term><literal>access_method_type</literal></term> |
| 61 | + <listitem> |
| 62 | + <para> |
| 63 | + This clause specifies type of access method to define. |
| 64 | + Only <literal>INDEX</literal> is supported at present. |
| 65 | + </para> |
| 66 | + </listitem> |
| 67 | + </varlistentry> |
| 68 | + |
| 69 | + <varlistentry> |
| 70 | + <term><literal>HANDLER <replaceable class="parameter">handler_function</replaceable></literal></term> |
| 71 | + <listitem> |
| 72 | + <para><replaceable class="parameter">handler_function</replaceable> is the |
| 73 | + name of a previously registered function that will be called to |
| 74 | + retrieve the struct which contains required parameters and functions |
| 75 | + of access method to the core. The handler function must take single |
| 76 | + argument of type <type>internal</>, and its return type depends on the |
| 77 | + type of access method; for <literal>INDEX</literal> access methods, it |
| 78 | + must be <type>index_am_handler</type>. |
| 79 | + </para> |
| 80 | + |
| 81 | + <para> |
| 82 | + See <xref linkend="index-api"> for index access methods API. |
| 83 | + </para> |
| 84 | + </listitem> |
| 85 | + </varlistentry> |
| 86 | + </variablelist> |
| 87 | + </refsect1> |
| 88 | + |
| 89 | + <refsect1> |
| 90 | + <title>Examples</title> |
| 91 | + |
| 92 | + <para> |
| 93 | + Create an access method <literal>heptree</> with |
| 94 | + handler function <literal>heptree_handler</>: |
| 95 | +<programlisting> |
| 96 | +CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler; |
| 97 | +</programlisting> |
| 98 | + </para> |
| 99 | + </refsect1> |
| 100 | + |
| 101 | + <refsect1> |
| 102 | + <title>Compatibility</title> |
| 103 | + |
| 104 | + <para> |
| 105 | + <command>CREATE ACCESS METHOD</command> is a |
| 106 | + <productname>PostgreSQL</> extension. |
| 107 | + </para> |
| 108 | + </refsect1> |
| 109 | + |
| 110 | + <refsect1> |
| 111 | + <title>See Also</title> |
| 112 | + |
| 113 | + <simplelist type="inline"> |
| 114 | + <member><xref linkend="sql-drop-access-method"></member> |
| 115 | + <member><xref linkend="sql-createopclass"></member> |
| 116 | + <member><xref linkend="sql-createopfamily"></member> |
| 117 | + </simplelist> |
| 118 | + </refsect1> |
| 119 | + |
| 120 | +</refentry> |
0 commit comments