aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/create_access_method.sgml
blob: 3c091f8021094be133b8a5c021a61ba4cd5d193c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<!--
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>
    <term><literal>access_method_type</literal></term>
    <listitem>
     <para>
      This clause specifies type of access method to define.
      Only <literal>INDEX</literal> is supported at present.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>HANDLER <replaceable class="parameter">handler_function</replaceable></literal></term>
    <listitem>
     <para><replaceable class="parameter">handler_function</replaceable> is the
      name of a previously registered function that will be called to
      retrieve the struct which contains required parameters and functions
      of access method to the core.  The handler function must take single
      argument of type <type>internal</>, 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>.
     </para>

     <para>
      See <xref linkend="index-api"> for index access methods API.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   Create an access method <literal>heptree</> with
   handler function <literal>heptree_handler</>:
<programlisting>
CREATE ACCESS METHOD heptree TYPE INDEX HANDLER heptree_handler;
</programlisting>
  </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   <command>CREATE ACCESS METHOD</command> is a
   <productname>PostgreSQL</> extension.
  </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>