1<!-- 2doc/src/sgml/ref/create_tstemplate.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="sql-createtstemplate"> 7 <indexterm zone="sql-createtstemplate"> 8 <primary>CREATE TEXT SEARCH TEMPLATE</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>CREATE TEXT SEARCH TEMPLATE</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>CREATE TEXT SEARCH TEMPLATE</refname> 19 <refpurpose>define a new text search template</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24CREATE TEXT SEARCH TEMPLATE <replaceable class="parameter">name</replaceable> ( 25 [ INIT = <replaceable class="parameter">init_function</replaceable> , ] 26 LEXIZE = <replaceable class="parameter">lexize_function</replaceable> 27) 28</synopsis> 29 </refsynopsisdiv> 30 31 <refsect1> 32 <title>Description</title> 33 34 <para> 35 <command>CREATE TEXT SEARCH TEMPLATE</command> creates a new text search 36 template. Text search templates define the functions that implement 37 text search dictionaries. A template is not useful by itself, but must 38 be instantiated as a dictionary to be used. The dictionary typically 39 specifies parameters to be given to the template functions. 40 </para> 41 42 <para> 43 If a schema name is given then the text search template is created in the 44 specified schema. Otherwise it is created in the current schema. 45 </para> 46 47 <para> 48 You must be a superuser to use <command>CREATE TEXT SEARCH 49 TEMPLATE</command>. This restriction is made because an erroneous text 50 search template definition could confuse or even crash the server. 51 The reason for separating templates from dictionaries is that a template 52 encapsulates the <quote>unsafe</quote> aspects of defining a dictionary. 53 The parameters that can be set when defining a dictionary are safe for 54 unprivileged users to set, and so creating a dictionary need not be a 55 privileged operation. 56 </para> 57 58 <para> 59 Refer to <xref linkend="textsearch"/> for further information. 60 </para> 61 </refsect1> 62 63 <refsect1> 64 <title>Parameters</title> 65 66 <variablelist> 67 <varlistentry> 68 <term><replaceable class="parameter">name</replaceable></term> 69 <listitem> 70 <para> 71 The name of the text search template to be created. The name can be 72 schema-qualified. 73 </para> 74 </listitem> 75 </varlistentry> 76 77 <varlistentry> 78 <term><replaceable class="parameter">init_function</replaceable></term> 79 <listitem> 80 <para> 81 The name of the init function for the template. 82 </para> 83 </listitem> 84 </varlistentry> 85 86 <varlistentry> 87 <term><replaceable class="parameter">lexize_function</replaceable></term> 88 <listitem> 89 <para> 90 The name of the lexize function for the template. 91 </para> 92 </listitem> 93 </varlistentry> 94 </variablelist> 95 96 <para> 97 The function names can be schema-qualified if necessary. Argument types 98 are not given, since the argument list for each type of function is 99 predetermined. The lexize function is required, but the init function 100 is optional. 101 </para> 102 103 <para> 104 The arguments can appear in any order, not only the one shown above. 105 </para> 106 </refsect1> 107 108 <refsect1> 109 <title>Compatibility</title> 110 111 <para> 112 There is no 113 <command>CREATE TEXT SEARCH TEMPLATE</command> statement in the SQL 114 standard. 115 </para> 116 </refsect1> 117 118 <refsect1> 119 <title>See Also</title> 120 121 <simplelist type="inline"> 122 <member><xref linkend="sql-altertstemplate"/></member> 123 <member><xref linkend="sql-droptstemplate"/></member> 124 </simplelist> 125 </refsect1> 126</refentry> 127