~ubuntu-branches/ubuntu/utopic/pgadmin3/utopic-proposed

« back to all changes in this revision

Viewing changes to docs/en_US/pg/sql-createconversion.html

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Enrici
  • Date: 2004-12-14 23:46:39 UTC
  • Revision ID: james.westby@ubuntu.com-20041214234639-tve0i5l49fq13jli
Tags: upstream-1.2.0
ImportĀ upstreamĀ versionĀ 1.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 
4
<title>CREATE CONVERSION</title>
 
5
<link rel="stylesheet" href="stylesheet.css" type="text/css">
 
6
<link rev="made" href="pgsql-docs@postgresql.org">
 
7
<meta name="generator" content="DocBook XSL Stylesheets V1.64.1">
 
8
<link rel="home" href="index.html" title="PostgreSQL 8.0.0beta5 Documentation">
 
9
<link rel="up" href="sql-commands.html" title="SQL Commands">
 
10
<link rel="previous" href="sql-createconstraint.html" title="CREATE CONSTRAINT TRIGGER">
 
11
<link rel="next" href="sql-createdatabase.html" title="CREATE DATABASE">
 
12
</head>
 
13
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
 
14
<a name="sql-createconversion"></a><div class="titlepage">
 
15
<div></div>
 
16
<div></div>
 
17
</div>
 
18
<div class="refnamediv">
 
19
<h2>Name</h2>
 
20
<p>CREATE CONVERSION &#8212; define a new conversion</p>
 
21
</div>
 
22
<a name="id2670714"></a><div class="refsynopsisdiv">
 
23
<h2>Synopsis</h2>
 
24
<pre class="synopsis">CREATE [DEFAULT] CONVERSION <i class="replaceable"><tt>name</tt></i>
 
25
    FOR <i class="replaceable"><tt>source_encoding</tt></i> TO <i class="replaceable"><tt>dest_encoding</tt></i> FROM <i class="replaceable"><tt>funcname</tt></i></pre>
 
26
</div>
 
27
<div class="refsect1" lang="en">
 
28
<a name="sql-createconversion-description"></a><h2>Description</h2>
 
29
<p>   <tt class="command">CREATE CONVERSION</tt> defines a new encoding
 
30
   conversion.  Conversion names may be used in the <tt class="function">convert</tt> function
 
31
   to specify a particular encoding conversion.  Also, conversions that
 
32
   are marked <tt class="literal">DEFAULT</tt> can be used for automatic encoding conversion between
 
33
   client and server. For this purpose, two conversions, from encoding A to
 
34
   B <span class="emphasis"><em>and</em></span> from encoding B to A, must be defined.
 
35
 </p>
 
36
<p>   To be able to create a conversion, you must have <tt class="literal">EXECUTE</tt> privilege
 
37
   on the function and <tt class="literal">CREATE</tt> privilege on the destination schema.
 
38
  </p>
 
39
</div>
 
40
<div class="refsect1" lang="en">
 
41
<a name="id2670798"></a><h2>Parameters</h2>
 
42
<div class="variablelist"><dl>
 
43
<dt><span class="term"><tt class="literal">DEFAULT</tt></span></dt>
 
44
<dd><p>       The <tt class="literal">DEFAULT</tt> clause indicates that this conversion
 
45
       is the default for this particular source to destination
 
46
       encoding. There should be only one default encoding in a schema
 
47
       for the encoding pair.
 
48
      </p></dd>
 
49
<dt><span class="term"><i class="replaceable"><tt>name</tt></i></span></dt>
 
50
<dd><p>       The name of the conversion. The conversion name may be
 
51
       schema-qualified. If it is not, the conversion is defined in the
 
52
       current schema. The conversion name must be unique within a
 
53
       schema.
 
54
      </p></dd>
 
55
<dt><span class="term"><i class="replaceable"><tt>source_encoding</tt></i></span></dt>
 
56
<dd><p>       The source encoding name.
 
57
      </p></dd>
 
58
<dt><span class="term"><i class="replaceable"><tt>dest_encoding</tt></i></span></dt>
 
59
<dd><p>       The destination encoding name.
 
60
      </p></dd>
 
61
<dt><span class="term"><i class="replaceable"><tt>funcname</tt></i></span></dt>
 
62
<dd>
 
63
<p>       The function used to perform the conversion.  The function name may
 
64
       be schema-qualified.  If it is not, the function will be looked
 
65
       up in the path.
 
66
      </p>
 
67
<p>       The function must have the following signature:
 
68
 
 
69
</p>
 
70
<pre class="programlisting">conv_proc(
 
71
    integer,  -- source encoding ID
 
72
    integer,  -- destination encoding ID
 
73
    cstring,  -- source string (null terminated C string)
 
74
    cstring,  -- destination string (null terminated C string)
 
75
    integer   -- source string length
 
76
) RETURNS void;</pre>
 
77
<p>
 
78
      </p>
 
79
</dd>
 
80
</dl></div>
 
81
</div>
 
82
<div class="refsect1" lang="en">
 
83
<a name="sql-createconversion-notes"></a><h2>Notes</h2>
 
84
<p>   Use <tt class="command">DROP CONVERSION</tt> to remove user-defined conversions.
 
85
  </p>
 
86
<p>   The privileges required to create a conversion may be changed in a future
 
87
   release.
 
88
  </p>
 
89
</div>
 
90
<div class="refsect1" lang="en">
 
91
<a name="sql-createconversion-examples"></a><h2>Examples</h2>
 
92
<p>   To create a conversion from encoding <tt class="literal">UNICODE</tt> to
 
93
   <tt class="literal">LATIN1</tt> using <tt class="function">myfunc</tt>:
 
94
</p>
 
95
<pre class="programlisting">CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc;</pre>
 
96
<p>
 
97
  </p>
 
98
</div>
 
99
<div class="refsect1" lang="en">
 
100
<a name="sql-createconversion-compat"></a><h2>Compatibility</h2>
 
101
<p>    <tt class="command">CREATE CONVERSION</tt>
 
102
    is a <span class="productname">PostgreSQL</span> extension.
 
103
    There is no <tt class="command">CREATE CONVERSION</tt>
 
104
    statement in the SQL standard.
 
105
  </p>
 
106
</div>
 
107
<div class="refsect1" lang="en">
 
108
<a name="sql-createconversion-seealso"></a><h2>See Also</h2>
 
109
<span class="simplelist"><a href="sql-alterconversion.html">ALTER CONVERSION</a>, <a href="sql-createfunction.html">CREATE FUNCTION</a>, <a href="sql-dropconversion.html">DROP CONVERSION</a></span>
 
110
</div>
 
111
</div></body>
 
112
</html>