builtin langs - clarify and add some links
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/commit/1332870d Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/tree/1332870d Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/diff/1332870d Branch: refs/heads/develop Commit: 1332870d01d2f8da2f8284ac167253d7005c6dfd Parents: bd85fdb Author: Lisa Owen <[email protected]> Authored: Mon Oct 10 15:24:20 2016 -0700 Committer: Lisa Owen <[email protected]> Committed: Mon Oct 10 15:24:20 2016 -0700 ---------------------------------------------------------------------- plext/UsingProceduralLanguages.html.md.erb | 6 +++--- plext/builtin_langs.html.md.erb | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/blob/1332870d/plext/UsingProceduralLanguages.html.md.erb ---------------------------------------------------------------------- diff --git a/plext/UsingProceduralLanguages.html.md.erb b/plext/UsingProceduralLanguages.html.md.erb index c920486..ea23982 100644 --- a/plext/UsingProceduralLanguages.html.md.erb +++ b/plext/UsingProceduralLanguages.html.md.erb @@ -4,11 +4,11 @@ title: Using Languages and Extensions in HAWQ HAWQ supports user-defined functions created with the SQL and C built-in languages, including supporting user-defined aliases for internal functions. -HAWQ also allows user-defined functions to be written in languages other than SQL and C. These other languages are generically called *procedural languages* (PLs). +HAWQ also supports user-defined functions written in languages other than SQL and C. These other languages are generically called *procedural languages* (PLs) and are extensions to the core HAWQ functionality. HAWQ specifically supports the PL/Java, PL/Perl, PL/pgSQL, PL/Python, and PL/R procedural languages. -For a function written in a procedural language, the database server has no built-in knowledge about how to interpret the function's source text. Instead, the task is passed to a special handler that knows the details of the language. The handler could either do all the work of parsing, syntax analysis, execution, and so on itself, or it could serve as "glue" between HAWQ and an existing implementation of a programming language. The handler itself is a C language function compiled into a shared object and loaded on demand, just like any other C function. +HAWQ additionally provides the `pgcrypto` extension for password hashing and data encryption. -This chapter describes the following: +This chapter describes these languages and extensions: - <a href="builtin_langs.html">Using HAWQ Built-In Languages</a> - <a href="using_pljava.html">Using PL/Java</a> http://git-wip-us.apache.org/repos/asf/incubator-hawq-docs/blob/1332870d/plext/builtin_langs.html.md.erb ---------------------------------------------------------------------- diff --git a/plext/builtin_langs.html.md.erb b/plext/builtin_langs.html.md.erb index 761a1d8..a630732 100644 --- a/plext/builtin_langs.html.md.erb +++ b/plext/builtin_langs.html.md.erb @@ -13,7 +13,7 @@ Support for SQL, internal, and C language user-defined functions is enabled by d ## <a id="builtinsql"></a>SQL -SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a `SELECT` that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query. +SQL functions execute an arbitrary list of SQL statements. The SQL statements in the body of an SQL function must be separated by semicolons. The final statement in a non-void-returning SQL function must be a [SELECT](../reference/sql/SELECT.html) that returns data of the type specified by the function's return type. The function will return a single or set of rows corresponding to this last SQL query. The following example creates and calls an SQL function to count the number of rows of the database named `orders`: @@ -33,19 +33,19 @@ For additional information on creating SQL functions, refer to [Query Language ( ## <a id="builtininternal"></a>Internal -Many HAWQ internal functions are written in C. These functions are declared during initialization of the database cluster and statically linked to the HAWQ server. +Many HAWQ internal functions are written in C. These functions are declared during initialization of the database cluster and statically linked to the HAWQ server. See [Built-in Functions and Operators](../query/functions-operators.html#topic29) for detailed information on HAWQ internal functions. While users cannot define new internal functions, they can create aliases for existing internal functions. -The following example creates a new function named `to_upper` that will be an alias for the `upper` internal HAWQ function: +The following example creates a new function named `all_caps` that will be defined as an alias for the `upper` HAWQ internal function: ``` sql -gpadmin=# CREATE FUNCTION to_upper (text) RETURNS text AS 'upper' +gpadmin=# CREATE FUNCTION all_caps (text) RETURNS text AS 'upper' LANGUAGE internal STRICT; CREATE FUNCTION -gpadmin=# SELECT to_upper('change me'); - to_upper +gpadmin=# SELECT all_caps('change me'); + all_caps ----------- CHANGE ME (1 row) @@ -58,9 +58,15 @@ For more information on aliasing internal functions, refer to [Internal Function User-defined functions written in C must be compiled into shared libraries to be loaded by the HAWQ server on demand. This dynamic loading distinguishes C language functions from internal functions that are written in C. -The `CREATE FUNCTION` call for a user-defined C function must include both the name of the shared library and the name of the function. +The [CREATE FUNCTION](../reference/sql/CREATE-FUNCTION.html) call for a user-defined C function must include both the name of the shared library and the name of the function. -If an absolute path to the shared library is not provided, an attempt is made to locate the library relative to: the HAWQ PostgreSQL library directory (obtained via the `pg_config --pkglibdir` command), the `dynamic_library_path` configuration value, and the current working directory, in that order. +If an absolute path to the shared library is not provided, an attempt is made to locate the library relative to the: + +1. HAWQ PostgreSQL library directory (obtained via the `pg_config --pkglibdir` command) +2. `dynamic_library_path` configuration value +3. current working directory + +in that order. Example:
