Alter the signature for encoding conversion functions to declare the
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 3 May 2005 19:18:48 +0000 (19:18 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 3 May 2005 19:18:48 +0000 (19:18 +0000)
output area as INTERNAL not CSTRING.  This is to prevent people from
calling the functions by hand.  This is a permanent solution for the
back branches but I hope it is just a stopgap for HEAD.

doc/src/sgml/ref/create_conversion.sgml
src/backend/commands/conversioncmds.c
src/backend/utils/mb/conversion_procs/Makefile

index 9136f896e8b93d354bc97de76b520738f3f70783..be011dcabb69907c46c9b28af57272e9a16b044c 100644 (file)
@@ -8,7 +8,7 @@
 
  <refnamediv>
   <refname>CREATE CONVERSION</refname>
-  <refpurpose>define a new conversion</refpurpose>
+  <refpurpose>define a new encoding conversion</refpurpose>
  </refnamediv>
 
  <indexterm zone="sql-createconversion">
@@ -26,10 +26,12 @@ CREATE [DEFAULT] CONVERSION <replaceable>name</replaceable>
   <title>Description</title>
 
   <para>
-   <command>CREATE CONVERSION</command> defines a new encoding
-   conversion.  Conversion names may be used in the <function>convert</function> function
+   <command>CREATE CONVERSION</command> defines a new conversion between
+   character set encodings.  Conversion names may be used in the
+   <function>convert</function> function
    to specify a particular encoding conversion.  Also, conversions that
-   are marked <literal>DEFAULT</> can be used for automatic encoding conversion between
+   are marked <literal>DEFAULT</> can be used for automatic encoding
+   conversion between
    client and server. For this purpose, two conversions, from encoding A to
    B <emphasis>and</emphasis> from encoding B to A, must be defined.
  </para>
@@ -109,7 +111,7 @@ conv_proc(
     integer,  -- source encoding ID
     integer,  -- destination encoding ID
     cstring,  -- source string (null terminated C string)
-    cstring,  -- destination string (null terminated C string)
+    internal, -- destination (fill with a null terminated C string)
     integer   -- source string length
 ) RETURNS void;
 </programlisting>
index 56a90530161a455ad7b8044b9db25f113222cc20..e56f651d52e968b4800ad57666e6f55b473e2093 100644 (file)
@@ -45,7 +45,7 @@ CreateConversionCommand(CreateConversionStmt *stmt)
        const char *from_encoding_name = stmt->for_encoding_name;
        const char *to_encoding_name = stmt->to_encoding_name;
        List       *func_name = stmt->func_name;
-       static Oid      funcargs[] = {INT4OID, INT4OID, CSTRINGOID, CSTRINGOID, INT4OID};
+       static Oid      funcargs[] = {INT4OID, INT4OID, CSTRINGOID, INTERNALOID, INT4OID};
 
        /* Convert list of names to a name and namespace */
        namespaceId = QualifiedNameGetCreationNamespace(stmt->conversion_name,
index b6876137a1df173630e9f2e263d3450db6a4dcf1..450b2011073ece41d5293145d2efc95c8c9fca09 100644 (file)
@@ -159,7 +159,7 @@ ifeq ($(enable_shared), yes)
                func=$$1; shift; \
                obj=$$1; shift; \
                echo "-- $$se --> $$de"; \
-               echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, CSTRING, CSTRING, INTEGER) RETURNS VOID AS '$$"libdir"/$$obj', '$$func' LANGUAGE 'c' STRICT;"; \
+               echo "CREATE OR REPLACE FUNCTION $$func (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER) RETURNS VOID AS '$$"libdir"/$$obj', '$$func' LANGUAGE 'c' STRICT;"; \
                echo "DROP CONVERSION pg_catalog.$$name;"; \
                echo "CREATE DEFAULT CONVERSION pg_catalog.$$name FOR '$$se' TO '$$de' FROM $$func;"; \
        done > $@