1CREATE CONVERSION()              SQL Commands              CREATE CONVERSION()
2
3
4

NAME

6       CREATE CONVERSION - define a new encoding conversion
7
8

SYNOPSIS

10       CREATE [ DEFAULT ] CONVERSION name
11           FOR source_encoding TO dest_encoding FROM funcname
12
13

DESCRIPTION

15       CREATE CONVERSION defines a new conversion between character set encod‐
16       ings. Conversion names may be used in the convert function to specify a
17       particular  encoding  conversion.  Also,  conversions  that  are marked
18       DEFAULT can be used for automatic encoding  conversion  between  client
19       and server. For this purpose, two conversions, from encoding A to B and
20       from encoding B to A, must be defined.
21
22       To be able to create a conversion, you must have EXECUTE  privilege  on
23       the function and CREATE privilege on the destination schema.
24

PARAMETERS

26       DEFAULT
27              The DEFAULT clause indicates that this conversion is the default
28              for this particular source to destination encoding. There should
29              be only one default encoding in a schema for the encoding pair.
30
31       name   The  name  of the conversion. The conversion name may be schema-
32              qualified. If it is not, the conversion is defined in  the  cur‐
33              rent schema. The conversion name must be unique within a schema.
34
35       source_encoding
36              The source encoding name.
37
38       dest_encoding
39              The destination encoding name.
40
41       funcname
42              The  function  used to perform the conversion. The function name
43              may be schema-qualified. If it is  not,  the  function  will  be
44              looked up in the path.
45
46              The function must have the following signature:
47
48              conv_proc(
49                  integer,  -- source encoding ID
50                  integer,  -- destination encoding ID
51                  cstring,  -- source string (null terminated C string)
52                  internal, -- destination (fill with a null terminated C string)
53                  integer   -- source string length
54              ) RETURNS void;
55
56

NOTES

58       Use DROP CONVERSION to remove user-defined conversions.
59
60       The  privileges  required  to  create  a conversion may be changed in a
61       future release.
62

EXAMPLES

64       To create a conversion from encoding UTF8 to LATIN1 using myfunc:
65
66       CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
67
68

COMPATIBILITY

70       CREATE CONVERSION is a PostgreSQL extension.  There is no  CREATE  CON‐
71       VERSION statement in the SQL standard.
72

SEE ALSO

74       ALTER  CONVERSION  [alter_conversion(7)], CREATE FUNCTION [create_func‐
75       tion(l)], DROP CONVERSION [drop_conversion(l)]
76
77
78
79SQL - Language Statements         2008-06-08               CREATE CONVERSION()
Impressum