|
| 1 | +<!-- |
| 2 | +doc/src/sgml/ref/create_toaster.sgml |
| 3 | +PostgreSQL documentation |
| 4 | +--> |
| 5 | + |
| 6 | +<refentry id="sql-createtoaster"> |
| 7 | + <indexterm zone="sql-createtoaster"> |
| 8 | + <primary>CREATE TOASTER</primary> |
| 9 | + </indexterm> |
| 10 | + |
| 11 | + <refmeta> |
| 12 | + <refentrytitle>CREATE TOASTER</refentrytitle> |
| 13 | + <manvolnum>7</manvolnum> |
| 14 | + <refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 | + </refmeta> |
| 16 | + |
| 17 | + <refnamediv> |
| 18 | + <refname>CREATE TOASTER</refname> |
| 19 | + <refpurpose>define a new toaster</refpurpose> |
| 20 | + </refnamediv> |
| 21 | + |
| 22 | + <refsynopsisdiv> |
| 23 | +<synopsis> |
| 24 | +CREATE TOASTER [ IF NOT EXISTS ] <replaceable class="parameter">toaster_name</replaceable> HANDLER <replaceable class="parameter">handler_name</replaceable> |
| 25 | + |
| 26 | +</synopsis> |
| 27 | + |
| 28 | + </refsynopsisdiv> |
| 29 | + |
| 30 | + <refsect1 id="sql-createtoaster-description"> |
| 31 | + <title>Description</title> |
| 32 | + |
| 33 | + <para> |
| 34 | + <command>CREATE TOASTER</command> will attach already defined handler <replaceable class="parameter">handler_name</replaceable> |
| 35 | + function to a toaster with name <replaceable class="parameter">toaster_name</replaceable> |
| 36 | + in the current database. This function will be used for toasting and de-toasting |
| 37 | + values in toasted columns for tables where this toaster is set in <literal>CREATE TABLE |
| 38 | + ...TOASTER <replaceable class="parameter">toaster_name</replaceable>...</literal> or |
| 39 | + <literal>ALTER TABLE ALTER COLUMN ... SET TOASTER <replaceable class="parameter">toaster_name</replaceable>...</literal> |
| 40 | + command. New OID is assigned to a <replaceable class="parameter">toaster_name</replaceable> automatically. |
| 41 | + </para> |
| 42 | + |
| 43 | + <para> |
| 44 | + To be able to create a table, you must have <literal>USAGE</literal> |
| 45 | + privilege on all column types or the type in the <literal>OF</literal> |
| 46 | + clause, respectively. |
| 47 | + </para> |
| 48 | + </refsect1> |
| 49 | + |
| 50 | + <refsect1> |
| 51 | + <title>Parameters</title> |
| 52 | + |
| 53 | + <variablelist> |
| 54 | + |
| 55 | + <varlistentry> |
| 56 | + <term><literal>IF NOT EXISTS</literal></term> |
| 57 | + <listitem> |
| 58 | + <para> |
| 59 | + Do not throw an error if a toaster with the same name already exists. |
| 60 | + A notice is issued in this case. Note that there is no guarantee that |
| 61 | + the existing toaster is anything like the one that would have been |
| 62 | + created. |
| 63 | + </para> |
| 64 | + </listitem> |
| 65 | + </varlistentry> |
| 66 | + |
| 67 | + <varlistentry> |
| 68 | + <term><replaceable class="parameter">toaster_name</replaceable></term> |
| 69 | + <listitem> |
| 70 | + <para> |
| 71 | + The name of the toaster table to be created. |
| 72 | + </para> |
| 73 | + </listitem> |
| 74 | + </varlistentry> |
| 75 | + |
| 76 | + <varlistentry> |
| 77 | + <term><replaceable class="parameter">handler_name</replaceable></term> |
| 78 | + <listitem> |
| 79 | + <para> |
| 80 | + The name of toast functions handler procedure. Must be reigstered before |
| 81 | + using with <literal>CREATE FUNCTION</literal> command, example: |
| 82 | + CREATE FUNCTION dummy_toaster_handler(internal) |
| 83 | + RETURNS toaster_handler |
| 84 | + AS 'MODULE_PATHNAME' |
| 85 | + LANGUAGE C; |
| 86 | + </para> |
| 87 | + </listitem> |
| 88 | + </varlistentry> |
| 89 | + </variablelist> |
| 90 | + |
| 91 | + |
| 92 | + <refsect1 id="sql-createtoaster-examples"> |
| 93 | + <title>Examples</title> |
| 94 | + |
| 95 | + <para> |
| 96 | + Create toaster <structname>dummy_toaster</structname> with handler |
| 97 | + <structname>dummy_toaster_handler</structname>: |
| 98 | + |
| 99 | +<programlisting> |
| 100 | +CREATE FUNCTION dummy_toaster_handler(internal) |
| 101 | +RETURNS toaster_handler |
| 102 | +AS 'MODULE_PATHNAME' |
| 103 | +LANGUAGE C; |
| 104 | + |
| 105 | + |
| 106 | +CREATE TOASTER dummy_toaster HANDLER dummy_toaster_handler; |
| 107 | + |
| 108 | +COMMENT ON TOASTER dummy_toaster IS 'dummy_toaster is a dummy toaster'; |
| 109 | +</programlisting> |
| 110 | + </para> |
| 111 | + </refsect1> |
| 112 | + |
| 113 | + <refsect1 id="sql-createtable-compatibility" xreflabel="Compatibility"> |
| 114 | + <title>Compatibility</title> |
| 115 | + |
| 116 | + <para> |
| 117 | + The <command>CREATE TABLE</command> command does not conform to the |
| 118 | + <acronym>SQL</acronym>. |
| 119 | + </para> |
| 120 | + </refsect1> |
| 121 | + |
| 122 | + <refsect1> |
| 123 | + <title>See Also</title> |
| 124 | + |
| 125 | + <simplelist type="inline"> |
| 126 | + <member><xref linkend="sql-storage"/></member> |
| 127 | + <member><xref linkend="sql-createtable"/></member> |
| 128 | + <member><xref linkend="sql-createtableas"/></member> |
| 129 | + <member><xref linkend="sql-altertable"/></member> |
| 130 | + </simplelist> |
| 131 | + </refsect1> |
| 132 | +</refentry> |
0 commit comments