1CREATE CONVERSION(7)             SQL Commands             CREATE CONVERSION(7)
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. Also, conversions that are marked DEFAULT can be used  for  auto‐
17       matic  encoding conversion between client and server. For this purpose,
18       two conversions, from encoding A to B and from encoding B to A, must be
19       defined.
20
21       To  be  able to create a conversion, you must have EXECUTE privilege on
22       the function and CREATE privilege on the destination schema.
23

PARAMETERS

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

NOTES

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

EXAMPLES

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

COMPATIBILITY

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

SEE ALSO

73       ALTER CONVERSION [alter_conversion(7)], CREATE  FUNCTION  [create_func‐
74       tion(7)], DROP CONVERSION [drop_conversion(7)]
75
76
77
78SQL - Language Statements         2014-02-17              CREATE CONVERSION(7)
Impressum