Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 8d25d5c

Browse files
committed
Add CREATE CONVERSION/DROP CONVERSOION reference manual
1 parent 4be24fe commit 8d25d5c

File tree

4 files changed

+319
-2
lines changed

4 files changed

+319
-2
lines changed

doc/src/sgml/ref/allfiles.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.41 2002/07/18 23:11:27 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/allfiles.sgml,v 1.42 2002/07/22 08:57:15 ishii Exp $
33
PostgreSQL documentation
44
Complete list of usable sgml source files in this directory.
55
-->
@@ -53,6 +53,7 @@ Complete list of usable sgml source files in this directory.
5353
<!entity createAggregate system "create_aggregate.sgml">
5454
<!entity createCast system "create_cast.sgml">
5555
<!entity createConstraint system "create_constraint.sgml">
56+
<!entity createConversion system "create_conversion.sgml">
5657
<!entity createDatabase system "create_database.sgml">
5758
<!entity createDomain system "create_domain.sgml">
5859
<!entity createFunction system "create_function.sgml">
@@ -73,6 +74,7 @@ Complete list of usable sgml source files in this directory.
7374
<!entity delete system "delete.sgml">
7475
<!entity dropAggregate system "drop_aggregate.sgml">
7576
<!entity dropCast system "drop_cast.sgml">
77+
<!entity dropConversion system "drop_conversion.sgml">
7678
<!entity dropDatabase system "drop_database.sgml">
7779
<!entity dropDomain system "drop_domain.sgml">
7880
<!entity dropFunction system "drop_function.sgml">
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.1 2002/07/22 08:57:15 ishii Exp $ -->
2+
3+
<refentry id="SQL-CREATECONVERSION">
4+
<refmeta>
5+
<refentrytitle id="SQL-CREATECONVERSION-TITLE">CREATE CONVERSION</refentrytitle>
6+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
7+
</refmeta>
8+
9+
<refnamediv>
10+
<refname>CREATE CONVERSION</refname>
11+
<refpurpose>define a user-defined conversion</refpurpose>
12+
</refnamediv>
13+
14+
<refsynopsisdiv>
15+
<synopsis>
16+
CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable>
17+
FOR <replaceable>source_encoding</replaceable>
18+
TO <replaceable>dest_encoding</replaceable> FROM <replaceable>funcname</replaceable>
19+
</synopsis>
20+
</refsynopsisdiv>
21+
22+
<refsect1 id="sql-createconversion-description">
23+
<title>Description</title>
24+
25+
<para>
26+
<command>CREATE CONVERSION</command> defines a new encoding
27+
conversion. There are two kinds of conversions. A default
28+
conversion is used for an automatic encoding conversion between
29+
frontend and backend. There should be only one default conversion
30+
for source/destination encodings pair in a schema. None default
31+
conversion never be used for the automatic conversion. Instead it
32+
can be used for CONVERT() function.
33+
</para>
34+
35+
<para>
36+
To be able to create a conversion, you must have the execute right
37+
on the function and the usage right on the schema the function
38+
belongs to.
39+
</para>
40+
41+
<variablelist>
42+
<title>Parameters</title>
43+
44+
<varlistentry>
45+
<term><literal>DEFAULT</literal></term>
46+
47+
<listitem>
48+
<para>
49+
The <literal>DEFAULT</> clause indicates that this conversion
50+
is the default for this particular source to destination
51+
encoding. There should be only one default encoding in a schema
52+
for the encoding pair. A default encoding can be used for not
53+
only CONVERT() function, but also for the automatic encoding
54+
conversion between frontend and backend. For this purpose, two
55+
conversions, from encoding A to B AND encoding B to A, must be
56+
defined.
57+
</para>
58+
</listitem>
59+
</varlistentry>
60+
61+
<varlistentry>
62+
<term><replaceable>conversion_name</replaceable></term>
63+
64+
<listitem>
65+
<para>
66+
The name of the conversion. The conversion name may be
67+
schema-qualified. If it is not, a conversion is defined in the
68+
current schema. The conversion name must be unique with in a
69+
schema.
70+
</para>
71+
</listitem>
72+
</varlistentry>
73+
74+
<varlistentry>
75+
<term><replaceable>source_encoding</replaceable></term>
76+
77+
<listitem>
78+
<para>
79+
The source encoding name.
80+
</para>
81+
</listitem>
82+
</varlistentry>
83+
84+
<varlistentry>
85+
<term><replaceable>source_encoding</replaceable></term>
86+
87+
<listitem>
88+
<para>
89+
The destination encoding name.
90+
</para>
91+
</listitem>
92+
</varlistentry>
93+
94+
<varlistentry>
95+
<term><replaceable>funcname</replaceable></term>
96+
97+
<listitem>
98+
<para>
99+
The function used to perform the conversion. The function name may
100+
be schema-qualified. If it is not, the function will be looked
101+
up in the path.
102+
</para>
103+
104+
<para>
105+
The function must have following signature:
106+
107+
<programlisting>
108+
conv_proc(
109+
INTEGER, -- source encoding id
110+
INTEGER, -- destination encoding id
111+
OPAQUE, -- source string (null terminated C string)
112+
OPAQUE, -- destination string (null terminated C string)
113+
INTEGER -- source string length
114+
) returns INTEGER; -- dummy. returns nothing, actually.
115+
</programlisting>
116+
</para>
117+
</listitem>
118+
</varlistentry>
119+
</variablelist>
120+
121+
</refsect1>
122+
123+
<refsect1 id="sql-createconversion-notes">
124+
<title>Notes</title>
125+
126+
<para>
127+
Use <command>DROP CONVERSION</command> to remove user-defined conversions.
128+
</para>
129+
130+
<para>
131+
The privileges required to create a conversion may be changed in a future
132+
release.
133+
</para>
134+
135+
</refsect1>
136+
137+
138+
<refsect1 id="sql-createconversion-examples">
139+
<title>Examples</title>
140+
141+
<para>
142+
To create a conversion from encoding UNICODE to LATIN1 using myfunc:
143+
<programlisting>
144+
CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc;
145+
</programlisting>
146+
</para>
147+
</refsect1>
148+
149+
150+
<refsect1 id="sql-createconversion-compat">
151+
<title>Compatibility</title>
152+
153+
<para>
154+
<command>CREATE CONVERSION</command>
155+
is a <productname>PostgreSQL</productname> extension.
156+
There is no <command>CREATE OPERATOR</command>
157+
statement in <acronym>SQL99</acronym>.
158+
</para>
159+
</refsect1>
160+
161+
162+
<refsect1 id="sql-createconversion-seealso">
163+
<title>See Also</title>
164+
165+
<para>
166+
<xref linkend="sql-createfunction" endterm="sql-createfunction-title">,
167+
<xref linkend="sql-dropconversion" endterm="sql-dropconversion-title">,
168+
<citetitle>PostgreSQL Programmer's Guide</citetitle>
169+
</para>
170+
</refsect1>
171+
172+
</refentry>
173+
174+
<!-- Keep this comment at the end of the file
175+
Local variables:
176+
mode:sgml
177+
sgml-omittag:nil
178+
sgml-shorttag:t
179+
sgml-minimize-attributes:nil
180+
sgml-always-quote-attributes:t
181+
sgml-indent-step:1
182+
sgml-indent-data:t
183+
sgml-parent-document:nil
184+
sgml-default-dtd-file:"../reference.ced"
185+
sgml-exposed-tags:nil
186+
sgml-local-catalogs:("/usr/lib/sgml/catalog")
187+
sgml-local-ecat-files:nil
188+
End:
189+
-->

doc/src/sgml/ref/drop_conversion.sgml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_conversion.sgml,v 1.1 2002/07/22 08:57:15 ishii Exp $ -->
2+
3+
<refentry id="SQL-DROPCONVERSION">
4+
<refmeta>
5+
<refentrytitle id="SQL-DROPCONVERSION-TITLE">DROP CONVERSION</refentrytitle>
6+
<refmiscinfo>SQL - Language Statements</refmiscinfo>
7+
</refmeta>
8+
9+
<refnamediv>
10+
<refname>DROP CONVERSION</refname>
11+
<refpurpose>remove a user-defined conversion</refpurpose>
12+
</refnamediv>
13+
14+
<refsynopsisdiv>
15+
<synopsis>
16+
DROP CONVERSION <replaceable>conversion_name</replaceable>
17+
[ CASCADE | RESTRICT ]
18+
</synopsis>
19+
</refsynopsisdiv>
20+
21+
<refsect1 id="sql-dropconversion-description">
22+
<title>Description</title>
23+
24+
<para>
25+
<command>DROP CONVERSION</command> removes a previously defined conversion.
26+
</para>
27+
28+
<para>
29+
To be able to drop a conversion, you must own the conversion.
30+
</para>
31+
32+
<variablelist>
33+
<title>Parameters</title>
34+
35+
<varlistentry>
36+
<term><replaceable>conversion_name</replaceable></term>
37+
38+
<listitem>
39+
<para>
40+
The name of the conversion. The conversion name may be
41+
schema-qualified.
42+
</para>
43+
</listitem>
44+
</varlistentry>
45+
46+
<varlistentry>
47+
<term><literal>CASCADE</literal></term>
48+
<term><literal>RESTRICT</literal></term>
49+
50+
<listitem>
51+
<para>
52+
These key words do not have any effect, since there are no
53+
dependencies on conversions.
54+
</para>
55+
</listitem>
56+
</varlistentry>
57+
</variablelist>
58+
59+
</refsect1>
60+
61+
<refsect1 id="sql-dropconversion-notes">
62+
<title>Notes</title>
63+
64+
<para>
65+
Use <command>CREATE CONVERSION</command> to create user-defined conversions.
66+
</para>
67+
68+
<para>
69+
The privileges required to drop a conversion may be changed in a future
70+
release.
71+
</para>
72+
</refsect1>
73+
74+
75+
<refsect1 id="sql-dropconversion-examples">
76+
<title>Examples</title>
77+
78+
<para>
79+
To drop the conversion named myname:
80+
<programlisting>
81+
DROP CONVERSION myname;
82+
</programlisting>
83+
</para>
84+
</refsect1>
85+
86+
87+
<refsect1 id="sql-dropconversion-compat">
88+
<title>Compatibility</title>
89+
90+
<para>
91+
<command>DROP CONVERSION</command>
92+
is a <productname>PostgreSQL</productname> extension.
93+
There is no <command>DROP OPERATOR</command>
94+
statement in <acronym>SQL99</acronym>.
95+
</para>
96+
</refsect1>
97+
98+
99+
<refsect1 id="sql-dropconversion-seealso">
100+
<title>See Also</title>
101+
102+
<para>
103+
<xref linkend="sql-createconversion" endterm="sql-createconversion-title">
104+
</para>
105+
</refsect1>
106+
107+
</refentry>
108+
109+
<!-- Keep this comment at the end of the file
110+
Local variables:
111+
mode:sgml
112+
sgml-omittag:nil
113+
sgml-shorttag:t
114+
sgml-minimize-attributes:nil
115+
sgml-always-quote-attributes:t
116+
sgml-indent-step:1
117+
sgml-indent-data:t
118+
sgml-parent-document:nil
119+
sgml-default-dtd-file:"../reference.ced"
120+
sgml-exposed-tags:nil
121+
sgml-local-catalogs:("/usr/lib/sgml/catalog")
122+
sgml-local-ecat-files:nil
123+
End:
124+
-->

doc/src/sgml/reference.sgml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- reference.sgml
2-
$Header: /cvsroot/pgsql/doc/src/sgml/reference.sgml,v 1.30 2002/07/18 23:11:27 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/reference.sgml,v 1.31 2002/07/22 08:57:15 ishii Exp $
33

44
PostgreSQL Reference Manual
55
-->
@@ -62,6 +62,7 @@ PostgreSQL Reference Manual
6262
&createAggregate;
6363
&createCast;
6464
&createConstraint;
65+
&createConversion;
6566
&createDatabase;
6667
&createDomain;
6768
&createFunction;
@@ -82,6 +83,7 @@ PostgreSQL Reference Manual
8283
&delete;
8384
&dropAggregate;
8485
&dropCast;
86+
&dropConversion;
8587
&dropDatabase;
8688
&dropDomain;
8789
&dropFunction;

0 commit comments

Comments
 (0)