You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hawq.apache.org by janebeckman <gi...@git.apache.org> on 2017/01/10 19:25:47 UTC
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
GitHub user janebeckman opened a pull request:
https://github.com/apache/incubator-hawq-docs/pull/85
Feature/hawq-1251
New pages for CREATE/DROP CAST/CONVERSION.
https://issues.apache.org/jira/browse/HAWQ-1251
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/janebeckman/incubator-hawq-docs feature/HAWQ-1251
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-hawq-docs/pull/85.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #85
----
commit 11455b2940304b68374ee8c1e57c2a9ce30d6c83
Author: Jane Beckman <jb...@pivotal.io>
Date: 2017-01-09T22:21:32Z
New SQL pages
commit 0fa21174885169bd2dde8e3da7b66f69f800b132
Author: Jane Beckman <jb...@pivotal.io>
Date: 2017-01-09T22:31:14Z
Navs for new SQL
commit d9a65569505e8017e2403193d86f918e22d35af7
Author: Jane Beckman <jb...@pivotal.io>
Date: 2017-01-10T19:06:30Z
Format and grammar improvements
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95693961
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
+
+``` pre
+INSERT INTO foo (f1) VALUES (42);
+```
+will be allowed if the cast from type integer to type text is marked `AS ASSIGNMENT`, otherwise not. The term assignment cast is typically used to describe this kind of cast.
+
+If the cast is marked `AS IMPLICIT` then it can be invoked implicitly in any context, whether assignment or internally in an expression. The term *implicit cast* is typically used to describe this kind of cast. For example, since `||` takes text operands,
+
+``` pre
+SELECT 'The time is ' || now();
+```
+It is wise to be conservative about marking casts as implicit. An overabundance of implicit casting paths can cause HAWQ to choose surprising interpretations of commands, or to be unable to resolve commands at all because there are multiple possible interpretations. A good rule of thumb is to make a cast implicitly invokable only for information-preserving transformations between types in the same general type category. For example, the cast from int2 to int4 can reasonably be implicit, but the cast from float8 to int4 should probably be assignment-only. Cross-type-category casts, such as text to int4, are best made explicit-only.
+
+To be able to create a cast, you must own the source or the target data type. To create a binary-compatible cast, you must be superuser.
+
+
+
+## <a id="topic1__section4"></a>Parameters
+
+<dt>\<sourcetype\> </dt>
+<dd>The name of the source data type of the cast.</dd>
+
+<dt>\<targettype\> </dt>
+<dd>The name of the target data type of the cast.</dd>
+
+<dt> \<funcname(argtypes)\> </dt>
+<dd>The function used to perform the cast. The function name may be schema-qualified. If it is not, the function is looked up in the schema search path. The function's result data type must match the target type of the cast.
+Cast implementation functions may have one to three arguments. The first argument type must be identical to the cast's source type. The second argument, if present, must be type `integer`; it receives the type modifier associated with the destination type, or `-1` if there is none. The third argument, if present, must be type `boolean`; it receives `true` if the cast is an explicit cast, `false` otherwise. In some cases, the SQL specification demands different behaviors for explicit and implicit casts. This argument is supplied for functions that must implement such casts. Designing your own data types this way is not recommended.
+Ordinarily, a cast must have different source and target data types. However, declaring a cast with identical source and target types is allowed if it has a cast implementation function with more than one argument. This is used to represent type-specific length coercion functions in the system catalogs. The named function is used to coerce a value of the type to the type modifier value specified by its second argument. (Since the grammar presently permits only certain built-in data types to have type modifiers, this feature is of no use for user-defined target types.)
+When a cast has different source and target types and a function that takes more than one argument, it represents a conversion from one type to another and applying a length coercion in a single step. When no such entry is available, coercion to a type that uses a type modifier involves two steps, one to convert between data types and a second to apply the modifier.
+</dd>
+
+<dt>WITHOUT FUNCTION \<call\_handler\> </dt>
--- End diff --
Neither the syntax block nor text mentions \<call\_handler\>. This also doesn't appear in the GPDB version of this reference.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by janebeckman <gi...@git.apache.org>.
Github user janebeckman closed the pull request at:
https://github.com/apache/incubator-hawq-docs/pull/85
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95695545
--- Diff: markdown/reference/sql/DROP-CONVERSION.html.md.erb ---
@@ -0,0 +1,48 @@
+---
--- End diff --
Something is wrong here - this content is a duplicate of `DROP-CAST.html.md.erb`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95690934
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
--- End diff --
Change `case text(int4)`to case `text(int4)`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by janebeckman <gi...@git.apache.org>.
Github user janebeckman commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95908029
--- Diff: markdown/reference/sql/CREATE-CONVERSION.html.md.erb ---
@@ -0,0 +1,72 @@
+---
+title: CREATE CONVERSION
+---
+
+Defines a new encoding conversion.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE [DEFAULT] CONVERSION name FOR source_encoding TO
+ dest_encoding FROM funcname
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CONVERSION` defines a new conversion between character set encodings. Conversion names may be used in the convert function to specify a particular encoding conversion. Also, conversions that are marked `DEFAULT` can be used for automatic encoding conversion between client and server. For this purpose, two conversions, from encoding A to B and from encoding B to A, must be defined.
+
+To create a conversion, you must have `EXECUTE` privilege on the function and `CREATE` privilege on the destination schema.
+
+
+## <a id="topic1__section4"></a>Parameters
+
+<dt>DEFAULT</dt>
+<dd>Indicates that this conversion is the default for this particular source to destination encoding. There should be only one default encoding in a schema for the encoding pair.</dd>
+
+<dt>\<name\> </dt>
+<dd>The name of the conversion. The conversion name may be schema-qualified. If it is not, the conversion is defined in the current schema. The conversion name must be unique within a schema.</dd>
+
+<dt>\<source_encoding\> </dt>
+<dd>The source encoding name.</dd>
+
+<dt>\<dest_encoding\> </dt>
+<dd>The destination encoding name.</dd>
+
+<dt>\<funcname\> </dt>
+<dd>The function used to perform the conversion. The function name may be schema-qualified. If it is not, the function will be looked up in the path. The function must have the following signature:</dd>
+
+``` pre
+conv_proc(
+ integer, -- source encoding ID
+ integer, -- destination encoding ID
+ cstring, -- source string (null terminated C string)
+ internal, -- destination (fill with a null terminated C string)
+ integer -- source string length
+) RETURNS void;
+```
+
+## <a id="topic1__section5"></a>Notes
+
+For this release of HAWQ, user-defined functions used in a user-defined cast must be defined as `IMMUTABLE`. Any compiled code (shared library files) for custom functions must be placed in the same location on every host in your HAWQ array (master and all segments). This location must also be in the `LD_LIBRARY_PATH` so that the server can locate the files.
+
+
+## <a id="topic1__section6"></a>Examples
+
+To create a conversion from encoding `UTF8` to `LATIN1` using `myfunc`:
+
+``` pre
+CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
+```
+
+## <a id="topic1__section7"></a>Compatibility
+
+There is no CREATE CONVERSION statement in the SQL standard.
+
+## <a id="topic1__section8"></a>See Also
+
+[DROP CONVERSION](DROP-CONVERSION.html), [CREATE FUNCTION](CREATE-FUNCTION.html)
--- End diff --
I didn't ask about that one, but it would make sense.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95692909
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
+
+``` pre
+INSERT INTO foo (f1) VALUES (42);
+```
+will be allowed if the cast from type integer to type text is marked `AS ASSIGNMENT`, otherwise not. The term assignment cast is typically used to describe this kind of cast.
+
+If the cast is marked `AS IMPLICIT` then it can be invoked implicitly in any context, whether assignment or internally in an expression. The term *implicit cast* is typically used to describe this kind of cast. For example, since `||` takes text operands,
--- End diff --
"whether assignment" -> "whether by assignment" ?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95693447
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
+
+``` pre
+INSERT INTO foo (f1) VALUES (42);
+```
+will be allowed if the cast from type integer to type text is marked `AS ASSIGNMENT`, otherwise not. The term assignment cast is typically used to describe this kind of cast.
+
+If the cast is marked `AS IMPLICIT` then it can be invoked implicitly in any context, whether assignment or internally in an expression. The term *implicit cast* is typically used to describe this kind of cast. For example, since `||` takes text operands,
+
+``` pre
+SELECT 'The time is ' || now();
+```
+It is wise to be conservative about marking casts as implicit. An overabundance of implicit casting paths can cause HAWQ to choose surprising interpretations of commands, or to be unable to resolve commands at all because there are multiple possible interpretations. A good rule of thumb is to make a cast implicitly invokable only for information-preserving transformations between types in the same general type category. For example, the cast from int2 to int4 can reasonably be implicit, but the cast from float8 to int4 should probably be assignment-only. Cross-type-category casts, such as text to int4, are best made explicit-only.
--- End diff --
Need to make all data types `code format` in this paragraph.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95694516
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
+
+``` pre
+INSERT INTO foo (f1) VALUES (42);
+```
+will be allowed if the cast from type integer to type text is marked `AS ASSIGNMENT`, otherwise not. The term assignment cast is typically used to describe this kind of cast.
+
+If the cast is marked `AS IMPLICIT` then it can be invoked implicitly in any context, whether assignment or internally in an expression. The term *implicit cast* is typically used to describe this kind of cast. For example, since `||` takes text operands,
+
+``` pre
+SELECT 'The time is ' || now();
+```
+It is wise to be conservative about marking casts as implicit. An overabundance of implicit casting paths can cause HAWQ to choose surprising interpretations of commands, or to be unable to resolve commands at all because there are multiple possible interpretations. A good rule of thumb is to make a cast implicitly invokable only for information-preserving transformations between types in the same general type category. For example, the cast from int2 to int4 can reasonably be implicit, but the cast from float8 to int4 should probably be assignment-only. Cross-type-category casts, such as text to int4, are best made explicit-only.
+
+To be able to create a cast, you must own the source or the target data type. To create a binary-compatible cast, you must be superuser.
+
+
+
+## <a id="topic1__section4"></a>Parameters
+
+<dt>\<sourcetype\> </dt>
+<dd>The name of the source data type of the cast.</dd>
+
+<dt>\<targettype\> </dt>
+<dd>The name of the target data type of the cast.</dd>
+
+<dt> \<funcname(argtypes)\> </dt>
+<dd>The function used to perform the cast. The function name may be schema-qualified. If it is not, the function is looked up in the schema search path. The function's result data type must match the target type of the cast.
+Cast implementation functions may have one to three arguments. The first argument type must be identical to the cast's source type. The second argument, if present, must be type `integer`; it receives the type modifier associated with the destination type, or `-1` if there is none. The third argument, if present, must be type `boolean`; it receives `true` if the cast is an explicit cast, `false` otherwise. In some cases, the SQL specification demands different behaviors for explicit and implicit casts. This argument is supplied for functions that must implement such casts. Designing your own data types this way is not recommended.
+Ordinarily, a cast must have different source and target data types. However, declaring a cast with identical source and target types is allowed if it has a cast implementation function with more than one argument. This is used to represent type-specific length coercion functions in the system catalogs. The named function is used to coerce a value of the type to the type modifier value specified by its second argument. (Since the grammar presently permits only certain built-in data types to have type modifiers, this feature is of no use for user-defined target types.)
+When a cast has different source and target types and a function that takes more than one argument, it represents a conversion from one type to another and applying a length coercion in a single step. When no such entry is available, coercion to a type that uses a type modifier involves two steps, one to convert between data types and a second to apply the modifier.
+</dd>
+
+<dt>WITHOUT FUNCTION \<call\_handler\> </dt>
+<dd>Indicates that the source type and the target type are binary compatible, so no function is required to perform the cast.</dd>
+
+<dt>AS ASSIGNMENT \<valfunction\> </dt>
+<dd>Indicates that the cast may be invoked implicitly in assignment contexts.</dd>
+
+<dt>AS IMPLICIT \<valfunction\> </dt>
+<dd>Indicates that the cast may be invoked implicitly in any context.</dd>
+
+## <a id="topic1__section5"></a>Notes
+
+For this release of HAWQ, user-defined functions used in a user-defined cast must be defined as `IMMUTABLE`. Any compiled code (shared library files) for custom functions must be placed in the same location on every host in your HAWQ array (master and all segments). This location must also be in the `LD_LIBRARY_PATH` so that the server can locate the files.
+
+Remember that if you want to be able to convert types both ways, you need to declare casts both ways explicitly.
+
+We recommend that you follow the convention of naming cast implementation functions after the target data type, as the built-in cast implementation functions are named. Many users are used to being able to cast data types using a function-style notation, that is `typename(x)`.
+
+## <a id="topic1__section6"></a>Examples
+
+Create a cast from type `text` to type `int4` using the function `int4(text)`. (This cast is already predefined in the system.):
+
+``` pre
+CREATE CAST (text AS int4) WITH FUNCTION int4(text);
+```
+
+## <a id="topic1__section7"></a>Compatibility
+
+The `CREATE CAST` command conforms to the SQL standard, except that SQL does not make provisions for binary-compatible types or extra arguments to implementation functions. `AS IMPLICIT` is also a HAWQ extension.
+
+## <a id="topic1__section8"></a>See Also
+
+[DROP CAST](DROP-CAST.html)
+
+
+
+
+`
--- End diff --
Remove stray \` at end of file.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95694042
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
+
+``` pre
+INSERT INTO foo (f1) VALUES (42);
+```
+will be allowed if the cast from type integer to type text is marked `AS ASSIGNMENT`, otherwise not. The term assignment cast is typically used to describe this kind of cast.
+
+If the cast is marked `AS IMPLICIT` then it can be invoked implicitly in any context, whether assignment or internally in an expression. The term *implicit cast* is typically used to describe this kind of cast. For example, since `||` takes text operands,
+
+``` pre
+SELECT 'The time is ' || now();
+```
+It is wise to be conservative about marking casts as implicit. An overabundance of implicit casting paths can cause HAWQ to choose surprising interpretations of commands, or to be unable to resolve commands at all because there are multiple possible interpretations. A good rule of thumb is to make a cast implicitly invokable only for information-preserving transformations between types in the same general type category. For example, the cast from int2 to int4 can reasonably be implicit, but the cast from float8 to int4 should probably be assignment-only. Cross-type-category casts, such as text to int4, are best made explicit-only.
+
+To be able to create a cast, you must own the source or the target data type. To create a binary-compatible cast, you must be superuser.
+
+
+
+## <a id="topic1__section4"></a>Parameters
+
+<dt>\<sourcetype\> </dt>
+<dd>The name of the source data type of the cast.</dd>
+
+<dt>\<targettype\> </dt>
+<dd>The name of the target data type of the cast.</dd>
+
+<dt> \<funcname(argtypes)\> </dt>
+<dd>The function used to perform the cast. The function name may be schema-qualified. If it is not, the function is looked up in the schema search path. The function's result data type must match the target type of the cast.
+Cast implementation functions may have one to three arguments. The first argument type must be identical to the cast's source type. The second argument, if present, must be type `integer`; it receives the type modifier associated with the destination type, or `-1` if there is none. The third argument, if present, must be type `boolean`; it receives `true` if the cast is an explicit cast, `false` otherwise. In some cases, the SQL specification demands different behaviors for explicit and implicit casts. This argument is supplied for functions that must implement such casts. Designing your own data types this way is not recommended.
+Ordinarily, a cast must have different source and target data types. However, declaring a cast with identical source and target types is allowed if it has a cast implementation function with more than one argument. This is used to represent type-specific length coercion functions in the system catalogs. The named function is used to coerce a value of the type to the type modifier value specified by its second argument. (Since the grammar presently permits only certain built-in data types to have type modifiers, this feature is of no use for user-defined target types.)
+When a cast has different source and target types and a function that takes more than one argument, it represents a conversion from one type to another and applying a length coercion in a single step. When no such entry is available, coercion to a type that uses a type modifier involves two steps, one to convert between data types and a second to apply the modifier.
+</dd>
+
+<dt>WITHOUT FUNCTION \<call\_handler\> </dt>
+<dd>Indicates that the source type and the target type are binary compatible, so no function is required to perform the cast.</dd>
+
+<dt>AS ASSIGNMENT \<valfunction\> </dt>
+<dd>Indicates that the cast may be invoked implicitly in assignment contexts.</dd>
+
+<dt>AS IMPLICIT \<valfunction\> </dt>
--- End diff --
Neither the syntax block nor text mentions \<valfunction\>. This also doesn't appear in the GPDB version of this reference.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95690678
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
--- End diff --
Global edit: need to put < and > around variables, like <sourcetype> <targettype> <funcname> <argtypes> in keeping with the other reference pages.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by janebeckman <gi...@git.apache.org>.
Github user janebeckman commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95906839
--- Diff: markdown/reference/sql/DROP-CONVERSION.html.md.erb ---
@@ -0,0 +1,48 @@
+---
--- End diff --
This makes three times I've changed this file. I don't know what's going on, but it keeps reverting to the file I used as a template. I'm going to try changing it outside the repo, then copying it to overwrite the one in the repo and see if that works.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95695298
--- Diff: markdown/reference/sql/DROP-CAST.html.md.erb ---
@@ -0,0 +1,48 @@
+---
+title: DROP CAST
+---
+
+Removes a cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+DROP CAST [IF EXISTS] (sourcetype AS targettype) [CASCADE | RESTRICT]
--- End diff --
Global: Add < and > around \<sourcetype\> and \<targettype\>
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95694820
--- Diff: markdown/reference/sql/CREATE-CONVERSION.html.md.erb ---
@@ -0,0 +1,72 @@
+---
+title: CREATE CONVERSION
+---
+
+Defines a new encoding conversion.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
--- End diff --
Global: Need to add < and > around variables like \<name\> \<source_encoding\> \<dest_encoding\> \<funcname\>
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95693348
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
--- End diff --
text -> `text`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95691137
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
--- End diff --
<typename>
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95695146
--- Diff: markdown/reference/sql/CREATE-CONVERSION.html.md.erb ---
@@ -0,0 +1,72 @@
+---
+title: CREATE CONVERSION
+---
+
+Defines a new encoding conversion.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE [DEFAULT] CONVERSION name FOR source_encoding TO
+ dest_encoding FROM funcname
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CONVERSION` defines a new conversion between character set encodings. Conversion names may be used in the convert function to specify a particular encoding conversion. Also, conversions that are marked `DEFAULT` can be used for automatic encoding conversion between client and server. For this purpose, two conversions, from encoding A to B and from encoding B to A, must be defined.
+
+To create a conversion, you must have `EXECUTE` privilege on the function and `CREATE` privilege on the destination schema.
+
+
+## <a id="topic1__section4"></a>Parameters
+
+<dt>DEFAULT</dt>
+<dd>Indicates that this conversion is the default for this particular source to destination encoding. There should be only one default encoding in a schema for the encoding pair.</dd>
+
+<dt>\<name\> </dt>
+<dd>The name of the conversion. The conversion name may be schema-qualified. If it is not, the conversion is defined in the current schema. The conversion name must be unique within a schema.</dd>
+
+<dt>\<source_encoding\> </dt>
+<dd>The source encoding name.</dd>
+
+<dt>\<dest_encoding\> </dt>
+<dd>The destination encoding name.</dd>
+
+<dt>\<funcname\> </dt>
+<dd>The function used to perform the conversion. The function name may be schema-qualified. If it is not, the function will be looked up in the path. The function must have the following signature:</dd>
+
+``` pre
+conv_proc(
+ integer, -- source encoding ID
+ integer, -- destination encoding ID
+ cstring, -- source string (null terminated C string)
+ internal, -- destination (fill with a null terminated C string)
+ integer -- source string length
+) RETURNS void;
+```
+
+## <a id="topic1__section5"></a>Notes
+
+For this release of HAWQ, user-defined functions used in a user-defined cast must be defined as `IMMUTABLE`. Any compiled code (shared library files) for custom functions must be placed in the same location on every host in your HAWQ array (master and all segments). This location must also be in the `LD_LIBRARY_PATH` so that the server can locate the files.
+
+
+## <a id="topic1__section6"></a>Examples
+
+To create a conversion from encoding `UTF8` to `LATIN1` using `myfunc`:
+
+``` pre
+CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
+```
+
+## <a id="topic1__section7"></a>Compatibility
+
+There is no CREATE CONVERSION statement in the SQL standard.
+
+## <a id="topic1__section8"></a>See Also
+
+[DROP CONVERSION](DROP-CONVERSION.html), [CREATE FUNCTION](CREATE-FUNCTION.html)
--- End diff --
Should we also be including `ALTER CONVERSION` as part of this Jira?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95693995
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
+
+``` pre
+INSERT INTO foo (f1) VALUES (42);
+```
+will be allowed if the cast from type integer to type text is marked `AS ASSIGNMENT`, otherwise not. The term assignment cast is typically used to describe this kind of cast.
+
+If the cast is marked `AS IMPLICIT` then it can be invoked implicitly in any context, whether assignment or internally in an expression. The term *implicit cast* is typically used to describe this kind of cast. For example, since `||` takes text operands,
+
+``` pre
+SELECT 'The time is ' || now();
+```
+It is wise to be conservative about marking casts as implicit. An overabundance of implicit casting paths can cause HAWQ to choose surprising interpretations of commands, or to be unable to resolve commands at all because there are multiple possible interpretations. A good rule of thumb is to make a cast implicitly invokable only for information-preserving transformations between types in the same general type category. For example, the cast from int2 to int4 can reasonably be implicit, but the cast from float8 to int4 should probably be assignment-only. Cross-type-category casts, such as text to int4, are best made explicit-only.
+
+To be able to create a cast, you must own the source or the target data type. To create a binary-compatible cast, you must be superuser.
+
+
+
+## <a id="topic1__section4"></a>Parameters
+
+<dt>\<sourcetype\> </dt>
+<dd>The name of the source data type of the cast.</dd>
+
+<dt>\<targettype\> </dt>
+<dd>The name of the target data type of the cast.</dd>
+
+<dt> \<funcname(argtypes)\> </dt>
+<dd>The function used to perform the cast. The function name may be schema-qualified. If it is not, the function is looked up in the schema search path. The function's result data type must match the target type of the cast.
+Cast implementation functions may have one to three arguments. The first argument type must be identical to the cast's source type. The second argument, if present, must be type `integer`; it receives the type modifier associated with the destination type, or `-1` if there is none. The third argument, if present, must be type `boolean`; it receives `true` if the cast is an explicit cast, `false` otherwise. In some cases, the SQL specification demands different behaviors for explicit and implicit casts. This argument is supplied for functions that must implement such casts. Designing your own data types this way is not recommended.
+Ordinarily, a cast must have different source and target data types. However, declaring a cast with identical source and target types is allowed if it has a cast implementation function with more than one argument. This is used to represent type-specific length coercion functions in the system catalogs. The named function is used to coerce a value of the type to the type modifier value specified by its second argument. (Since the grammar presently permits only certain built-in data types to have type modifiers, this feature is of no use for user-defined target types.)
+When a cast has different source and target types and a function that takes more than one argument, it represents a conversion from one type to another and applying a length coercion in a single step. When no such entry is available, coercion to a type that uses a type modifier involves two steps, one to convert between data types and a second to apply the modifier.
+</dd>
+
+<dt>WITHOUT FUNCTION \<call\_handler\> </dt>
+<dd>Indicates that the source type and the target type are binary compatible, so no function is required to perform the cast.</dd>
+
+<dt>AS ASSIGNMENT \<valfunction\> </dt>
--- End diff --
Neither the syntax block nor text mentions \<valfunction\>. This also doesn't appear in the GPDB version of this reference.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95693049
--- Diff: markdown/reference/sql/CREATE-CAST.html.md.erb ---
@@ -0,0 +1,101 @@
+---
+title: CREATE CAST
+---
+
+Defines a new cast.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE CAST (sourcetype AS targettype)
+ WITH FUNCTION funcname (argtypes)
+ [AS ASSIGNMENT | AS IMPLICIT]
+
+CREATE CAST (sourcetype AS targettype) WITHOUT FUNCTION
+ [AS ASSIGNMENT | AS IMPLICIT]
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CAST` defines a new cast. A cast specifies how to perform a conversion between two data types. For example,
+
+```pre
+SELECT CAST(42 AS text);
+```
+
+converts the integer constant 42 to type `text` by invoking a previously specified function, in this `case text(int4)`. If no suitable cast has been defined, the conversion fails.
+
+Two types may be binary compatible, which means that they can be converted into one another without invoking any function. This requires that corresponding values use the same internal representation. For instance, the types `text` and `varchar` are binary compatible.
+
+By default, a cast can be invoked only by an explicit cast request, that is an explicit `CAST(x AS typename)` or `x:: typename` construct.
+
+If the cast is marked `AS ASSIGNMENT` then it can be invoked implicitly when assigning a value to a column of the target data type. For example, supposing that `foo.f1` is a column of type text, then:
+
+``` pre
+INSERT INTO foo (f1) VALUES (42);
+```
+will be allowed if the cast from type integer to type text is marked `AS ASSIGNMENT`, otherwise not. The term assignment cast is typically used to describe this kind of cast.
--- End diff --
assignment cast -> *assignment cast*
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] incubator-hawq-docs pull request #85: Feature/hawq-1251
Posted by dyozie <gi...@git.apache.org>.
Github user dyozie commented on a diff in the pull request:
https://github.com/apache/incubator-hawq-docs/pull/85#discussion_r95694272
--- Diff: markdown/reference/sql/CREATE-CONVERSION.html.md.erb ---
@@ -0,0 +1,72 @@
+---
+title: CREATE CONVERSION
+---
+
+Defines a new encoding conversion.
+
+## <a id="topic1__section2"></a>Synopsis
+
+``` pre
+CREATE [DEFAULT] CONVERSION name FOR source_encoding TO
+ dest_encoding FROM funcname
+```
+
+## <a id="topic1__section3"></a>Description
+
+`CREATE CONVERSION` defines a new conversion between character set encodings. Conversion names may be used in the convert function to specify a particular encoding conversion. Also, conversions that are marked `DEFAULT` can be used for automatic encoding conversion between client and server. For this purpose, two conversions, from encoding A to B and from encoding B to A, must be defined.
+
+To create a conversion, you must have `EXECUTE` privilege on the function and `CREATE` privilege on the destination schema.
+
+
+## <a id="topic1__section4"></a>Parameters
+
+<dt>DEFAULT</dt>
+<dd>Indicates that this conversion is the default for this particular source to destination encoding. There should be only one default encoding in a schema for the encoding pair.</dd>
+
+<dt>\<name\> </dt>
+<dd>The name of the conversion. The conversion name may be schema-qualified. If it is not, the conversion is defined in the current schema. The conversion name must be unique within a schema.</dd>
+
+<dt>\<source_encoding\> </dt>
+<dd>The source encoding name.</dd>
+
+<dt>\<dest_encoding\> </dt>
+<dd>The destination encoding name.</dd>
+
+<dt>\<funcname\> </dt>
+<dd>The function used to perform the conversion. The function name may be schema-qualified. If it is not, the function will be looked up in the path. The function must have the following signature:</dd>
+
+``` pre
+conv_proc(
+ integer, -- source encoding ID
+ integer, -- destination encoding ID
+ cstring, -- source string (null terminated C string)
+ internal, -- destination (fill with a null terminated C string)
+ integer -- source string length
+) RETURNS void;
+```
+
+## <a id="topic1__section5"></a>Notes
+
+For this release of HAWQ, user-defined functions used in a user-defined cast must be defined as `IMMUTABLE`. Any compiled code (shared library files) for custom functions must be placed in the same location on every host in your HAWQ array (master and all segments). This location must also be in the `LD_LIBRARY_PATH` so that the server can locate the files.
+
+
+## <a id="topic1__section6"></a>Examples
+
+To create a conversion from encoding `UTF8` to `LATIN1` using `myfunc`:
+
+``` pre
+CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
+```
+
+## <a id="topic1__section7"></a>Compatibility
+
+There is no CREATE CONVERSION statement in the SQL standard.
+
+## <a id="topic1__section8"></a>See Also
+
+[DROP CONVERSION](DROP-CONVERSION.html), [CREATE FUNCTION](CREATE-FUNCTION.html)
+
+
+
+
+`
--- End diff --
Remove stray \` character at end of file.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---