未验证 提交 ca7e4f9d 编写于 作者: D David Yozie 提交者: GitHub

Update PL's to use CREATE/DROP EXTENSION (#7490)

* update pl/r docs to use CREATE EXTENSION

* update pl/perl, /python, update deprecation notices, add CASCADE info

* Feedback from Chuck

* Update postgresql.org hrefs to 9.4

* Feedback from Lisa
上级 b4a14662
......@@ -302,6 +302,9 @@
database. For example, this command disables the PL/Java language in the
<codeph>testdb</codeph> database: </p>
<codeblock>$ psql -d testdb -c 'DROP EXTENSION pljava;'</codeblock>
<p> The default command fails if any existing objects (such as functions) depend on the
language. Specify the <codeph>CASCADE</codeph> option to also drop all dependent objects,
including functions that you created with PL/Java. </p>
<note>The PL/Java <codeph>uninstall.sql</codeph> script, used in previous releases to remove
the language registration, is deprecated.</note>
</body>
......
......@@ -29,7 +29,7 @@
functions. PL/Perl provides both trusted and untrusted variants of the language. </p>
<p> PL/Perl is embedded in your Greenplum Database distribution. Greenplum Database
PL/Perl requires Perl to be installed on the system of each database host. </p>
<p> Refer to the <xref href="https://www.postgresql.org/docs/9.1/plperl.html"
<p> Refer to the <xref href="https://www.postgresql.org/docs/9.4/plperl.html"
scope="external" format="html"> PostgreSQL PL/Perl documentation </xref> for
additional information. </p>
</body>
......@@ -77,7 +77,7 @@
user-defined functions. </p>
<p> PL/Perl has limitations with respect to communication between interpreters and the
number of interpreters running in a single process. Refer to the PostgreSQL <xref
href="https://www.postgresql.org/docs/9.1/plperl-trusted.html"
href="https://www.postgresql.org/docs/9.4/plperl-trusted.html"
scope="external" format="html">Trusted and Untrusted PL/Perl</xref>
documentation for additional information. </p>
</body>
......@@ -105,38 +105,25 @@
<title>Enabling PL/Perl Support</title>
<body>
<p> For each database in which you want to enable PL/Perl, register the language
using the SQL <codeph><xref href="../sql_commands/CREATE_LANGUAGE.xml#topic1"
>CREATE LANGUAGE</xref></codeph> command or the Greenplum Database
<codeph><xref
href="../../utility_guide/client_utilities/createlang.xml#topic1"
>createlang</xref></codeph> utility. For example, run the following
using the SQL <codeph><xref href="../sql_commands/CREATE_EXTENSION.xml">CREATE
EXTENSION</xref></codeph> command. For example, run the following
command as the <codeph>gpadmin</codeph> user to register the trusted PL/Perl
language for the database named <codeph>testdb</codeph>: </p>
<codeblock>$ createlang plperl -d testdb</codeblock>
<codeblock>$ psql -d testdb -c 'CREATE EXTENSION plperl;'</codeblock>
</body>
</topic>
<topic id="topic62" xml:lang="en">
<title>Removing PL/Perl Support</title>
<body>
<p> To remove support for PL/Perl from a database, run the SQL <codeph><xref
href="../sql_commands/DROP_LANGUAGE.xml#topic1">DROP
LANGUAGE</xref></codeph> command or the Greenplum Database <codeph><xref
href="../../utility_guide/client_utilities/droplang.xml#topic1"
>droplang</xref></codeph> utility. For example, run the following
command as the <codeph>gpadmin</codeph> user to remove support for the trusted
PL/Perl language from the database named <codeph>testdb</codeph>: </p>
<codeblock>
$ psql -d testdb
psql (9.4.20)
Type "help" for help.
testdb=# DROP LANGUAGE plperl;
</codeblock>
<p> The default <codeph>DROP LANGUAGE</codeph> behavior is
<codeph>RESTRICT</codeph>; the command fails if any existing objects (such as
functions) depend on the language. Specify the <codeph>CASCADE</codeph> clause
to also drop all dependent objects, including functions that you created with
PL/Perl. </p>
href="../sql_commands/DROP_EXTENSION.xml">DROP EXTENSION</xref></codeph>
command. For example, run the following command as the <codeph>gpadmin</codeph>
user to remove support for the trusted PL/Perl language from the database named
<codeph>testdb</codeph>: </p>
<codeblock>$ psql -d testdb -c 'DROP EXTENSION plperl;'</codeblock>
<p> The default command fails if any existing objects (such as functions) depend on
the language. Specify the <codeph>CASCADE</codeph> option to also drop all
dependent objects, including functions that you created with PL/Perl. </p>
</body>
</topic>
</topic>
......@@ -202,7 +189,7 @@ SELECT perl_max( 1, null );
statements accept any string that is an acceptable input format for the function's
declared return type. </p>
<p> Refer to the PostgreSQL <xref
href="https://www.postgresql.org/docs/9.1/plperl-funcs.html"
href="https://www.postgresql.org/docs/9.4/plperl-funcs.html"
scope="external" format="html">PL/Perl Functions and Arguments</xref>
documentation for additional information, including composite type and result set
manipulation. </p>
......@@ -262,7 +249,7 @@ SELECT return_match( 'iff' );
(1 row)
</codeblock>
<p> Refer to the PostgreSQL PL/Perl <xref
href="https://www.postgresql.org/docs/9.1/plperl-builtins.html"
href="https://www.postgresql.org/docs/9.4/plperl-builtins.html"
scope="external" format="html">Built-in Functions</xref> documentation for a
detailed discussion of available functions. </p>
</body>
......
......@@ -63,12 +63,11 @@
<title>Enabling PL/Python Support</title>
<body>
<p>For each database that requires its use, register the PL/Python language with the SQL
command <codeph>CREATE LANGUAGE</codeph> or the Greenplum Database utility
<codeph>createlang</codeph>. Because PL/Python is an untrusted language, only superusers
can register PL/Python with a database. For example, running this command as the
<codeph>gpadmin</codeph> system user registers PL/Python with the database named
command <codeph>CREATE EXTENSION</codeph>. Because PL/Python is an untrusted language,
only superusers can register PL/Python with a database. For example, running this command
as the <codeph>gpadmin</codeph> user registers PL/Python with the database named
<codeph>testdb</codeph>:</p>
<codeblock>$ createlang plpythonu -d testdb</codeblock>
<codeblock>$ psql -d testdb -c 'CREATE EXTENSION plpythonu;'</codeblock>
<p>PL/Python is registered as an untrusted language.</p>
</body>
</topic>
......@@ -76,14 +75,14 @@
<title>Removing PL/Python Support</title>
<body>
<p>For a database that no longer requires the PL/Python language, remove support for
PL/Python with the SQL command <codeph>DROP LANGUAGE</codeph> or the Greenplum Database
<codeph>droplang</codeph> utility. Because PL/Python is an untrusted language, only
superusers can remove support for the PL/Python language from a database. For example,
running this command as the <codeph>gpadmin</codeph> system user removes support for
PL/Python from the database named <codeph>testdb</codeph>:</p>
<codeblock>$ droplang plpythonu -d testdb</codeblock>
<p>When you remove support for PL/Python, the PL/Python user-defined functions that you
created in the database will no longer work. </p>
PL/Python with the SQL command <codeph>DROP EXTENSION</codeph>. Because PL/Python is an
untrusted language, only superusers can remove support for the PL/Python language from a
database. For example, running this command as the <codeph>gpadmin</codeph> user removes
support for PL/Python from the database named <codeph>testdb</codeph>:</p>
<codeblock>$ psql -d testdb -c 'DROP EXTENSION plpythonu;'</codeblock>
<p> The default command fails if any existing objects (such as functions) depend on the
language. Specify the <codeph>CASCADE</codeph> option to also drop all dependent objects,
including functions that you created with PL/Python. </p>
</body>
</topic>
</topic>
......@@ -176,7 +175,7 @@ SELECT * FROM composite_type_as_list();
{{"(first,1)","(second,1)"},{"(first,2)","(second,2)"},{"(first,3)","(second,3)"}}
(1 row) </codeblock>
<p>Refer to the PostgreSQL <xref
href="https://www.postgresql.org/docs/devel/plpython-data.html#plpython-arrays"
href="https://www.postgresql.org/docs/9.4/plpython-data.html#PLPYTHON-ARRAYS"
scope="external" format="html">Arrays, Lists</xref> documentation for additional
information on PL/Python handling of arrays and composite types.</p>
</body>
......@@ -191,7 +190,7 @@ SELECT * FROM composite_type_as_list();
run the query from multiple Python functions.</p>
<p>PL/Python also supports the <codeph>plpy.subtransaction()</codeph> function to help
manage <codeph>plpy.execute</codeph> calls in an explicit subtransaction. See <xref
href="https://www.postgresql.org/docs/9.1/plpython-subtransaction.html"
href="https://www.postgresql.org/docs/9.4/plpython-subtransaction.html"
format="html" scope="external">Explicit Subtransactions</xref> in the PostgreSQL
documentation for additional information about <codeph>plpy.subtransaction()</codeph>.</p>
</body>
......@@ -237,8 +236,8 @@ SELECT * FROM composite_type_as_list();
<p>When you prepare an execution plan using the PL/Python module the plan is automatically
saved. See the Postgres Server Programming Interface (SPI) documentation for information
about the execution plans <xref
href="https://www.postgresql.org/docs/8.3/spi.html" scope="external"
format="html">https://www.postgresql.org/docs/8.3/spi.html</xref>.</p>
href="https://www.postgresql.org/docs/9.4/spi.html" scope="external"
format="html">https://www.postgresql.org/docs/9.4/spi.html</xref>.</p>
<p>To make effective use of saved plans across function calls you use one of the Python
persistent storage dictionaries SD or GD. </p>
<p>The global dictionary SD is available to store data between function calls. This
......@@ -558,8 +557,8 @@ $$ language plpythonu;</codeblock>
<p>For information about the Python language, see <xref href="https://www.python.org/"
scope="external" format="html">https://www.python.org/</xref>.</p>
<p>For information about PL/Python see the PostgreSQL documentation at <xref
href="https://www.postgresql.org/docs/8.3/plpython.html" scope="external"
format="html">https://www.postgresql.org/docs/8.3/plpython.html</xref>. </p>
href="https://www.postgresql.org/docs/9.4/plpython.html" scope="external"
format="html">https://www.postgresql.org/docs/9.4/plpython.html</xref>. </p>
<p>For information about Python Package Index (PyPI), see <xref
href="https://pypi.python.org/pypi" format="html" scope="external"
>https://pypi.python.org/pypi</xref>.</p>
......
......@@ -85,6 +85,18 @@
</body>
</topic>
</topic>
<topic id="topic5" xml:lang="en">
<title>Enabling PL/R Language Support</title>
<body>
<p>For each database that requires its use, register the PL/R language with the SQL command
<codeph>CREATE EXTENSION</codeph>. Because PL/R is an untrusted language, only
superusers can register PL/R with a database. For example, run this command as the
<codeph>gpadmin</codeph> user to register the language with the database named
<codeph>testdb</codeph>:</p>
<codeblock>$ psql -d testdb -c 'CREATE EXTENSION plr;'</codeblock>
<p>PL/R is registered as an untrusted language.</p>
</body>
</topic>
<topic id="topic6" xml:lang="en" otherprops="pivotal">
<title id="py213692">Uninstalling PL/R</title>
<body>
......@@ -103,12 +115,14 @@
<title id="py216910">Remove PL/R Support for a Database</title>
<body>
<p>For a database that no longer requires the PL/R language, remove support for PL/R with
the SQL command <codeph>DROP LANGUAGE</codeph> or the Greenplum Database
<codeph>droplang</codeph> utility. Because PL/R is an untrusted language, only
superusers can remove support for the PL/R language from a database. For example,
running this command as the gpadmin user removes support for PL/R from the database
named <i>testdb</i>:</p>
<codeblock>$ droplang plr -d testdb</codeblock>
the SQL command <codeph>DROP EXTENSION</codeph>. Because PL/R is an untrusted language,
only superusers can remove support for the PL/R language from a database. For example,
run this command as the <codeph>gpadmin</codeph> user to remove support for PL/R from
the database named <codeph>testdb</codeph>:</p>
<codeblock>$ psql -d testdb -c 'DROP EXTENSION plr;'</codeblock>
<p> The default command fails if any existing objects (such as functions) depend on the
language. Specify the <codeph>CASCADE</codeph> option to also drop all dependent
objects, including functions that you created with PL/R. </p>
</body>
</topic>
<topic id="topic8" xml:lang="en">
......@@ -125,18 +139,6 @@
</body>
</topic>
</topic>
<topic id="topic5" xml:lang="en">
<title>Enabling PL/R Language Support</title>
<body>
<p>For each database that requires its use, register the PL/R language with the SQL command
<codeph>CREATE LANGUAGE</codeph> or the utility <codeph>createlang</codeph>. Because
PL/R is an untrusted language, only superusers can register PL/R with a database. For
example, running this command as the <codeph>gpadmin</codeph> system user registers the
language with the database named <i>testdb</i>:</p>
<codeblock>$ createlang plr -d testdb</codeblock>
<p>PL/R is registered as an untrusted language.</p>
</body>
</topic>
<topic id="topic9" xml:lang="en">
<title id="py214084">Examples</title>
<body>
......@@ -290,8 +292,9 @@ LANGUAGE 'plr';</codeblock><p>This
<body>
<p>You can use the R command line to display information about the installed libraries and
functions on the Greenplum Database host. You can also add and remove libraries from the R
installation. To start the R command line on the host, log into the host as the gadmin
user and run the script R from the directory <codeph>$GPHOME/ext/R-3.3.3/bin</codeph>.</p>
installation. To start the R command line on the host, log into the host as the
<codeph>gadmin</codeph> user and run the script R from the directory
<codeph>$GPHOME/ext/R-3.3.3/bin</codeph>.</p>
<p>This R function lists the available R packages from the R command line:</p>
<codeblock>&gt; library()</codeblock>
<p>Display the documentation for a particular R package</p>
......
......@@ -19,9 +19,9 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <varname>name</varname
<p><codeph>CREATE LANGUAGE</codeph> registers a new procedural language with a Greenplum
database. Subsequently, functions and trigger procedures can be defined in this new
language.</p>
<note>Some procedural languages for Greenplum Database have been made into "extensions,"
and should therefore be installed with <xref href="CREATE_EXTENSION.xml#topic1"/>,
not <codeph>CREATE LANGUAGE</codeph>. Using <codeph>CREATE LANGUAGE</codeph>
<note>Procedural languages for Greenplum Database have been made into "extensions," and
should therefore be installed with <xref href="CREATE_EXTENSION.xml#topic1"/>, not
<codeph>CREATE LANGUAGE</codeph>. Using <codeph>CREATE LANGUAGE</codeph>
directly should be restricted to extension installation scripts. If you have a
"bare" language in your database, perhaps as a result of an upgrade, you can convert
it to an extension using <codeph>CREATE EXTENSION <varname>langname</varname> FROM
......@@ -105,10 +105,10 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <varname>name</varname
</pt>
<pd>The name of the new procedural language. The name must be unique among the
languages in the database. Built-in support is included for
<codeph>plpgsql</codeph>, <codeph>plperl</codeph>,
<codeph>plpythonu</codeph>, and <codeph>plr</codeph>. The languages
<codeph>plpgsql</codeph> (PL/pgSQL) and <codeph>plpythonu</codeph>
(PL/Python) are installed by default in Greenplum Database.</pd>
<codeph>plpgsql</codeph>, <codeph>plperl</codeph>, and
<codeph>plpythonu</codeph>. The languages <codeph>plpgsql</codeph>
(PL/pgSQL) and <codeph>plpythonu</codeph> (PL/Python) are installed by
default in Greenplum Database.</pd>
</plentry>
<plentry>
<pt>HANDLER <varname>call_handler</varname></pt>
......@@ -168,9 +168,10 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <varname>name</varname
</section>
<section id="section6">
<title>Examples</title>
<p>The preferred way of creating any of the standard procedural languages:</p>
<codeblock>CREATE LANGUAGE plperl;
CREATE LANGUAGE plr;</codeblock>
<p>The preferred way of creating any of the standard procedural languages is to use
<codeph>CREATE EXTENSION</codeph> instead of <codeph>CREATE LANGUAGE</codeph>.
For example:</p>
<codeblock>CREATE EXTENSION plperl;</codeblock>
<p>For a language not known in the <codeph>pg_pltemplate</codeph> catalog:</p>
<codeblock>CREATE FUNCTION plsample_call_handler() RETURNS
language_handler
......@@ -186,10 +187,13 @@ CREATE LANGUAGE plsample
<section id="section8">
<title>See Also</title>
<p><codeph><xref href="ALTER_LANGUAGE.xml#topic1" type="topic" format="dita"/></codeph>,
<codeph><xref href="CREATE_FUNCTION.xml#topic1" type="topic" format="dita"
/></codeph>, <codeph><xref href="./DROP_LANGUAGE.xml#topic1" type="topic"
format="dita"/></codeph>, <codeph><xref href="./GRANT.xml#topic1"
type="topic" format="dita"/></codeph>
<codeph><xref href="CREATE_EXTENSION.xml" type="topic" format="dita"
/></codeph>, <codeph><xref href="CREATE_FUNCTION.xml#topic1" type="topic"
format="dita"/></codeph>, <codeph><xref href="./DROP_EXTENSION.xml#topic1"
type="topic" format="dita"/></codeph>, <codeph><xref
href="./DROP_LANGUAGE.xml#topic1" type="topic" format="dita"/></codeph>,
<codeph><xref href="./GRANT.xml#topic1" type="topic" format="dita"
/></codeph>
<codeph><xref href="DO.xml#topic1"/></codeph></p>
</section>
</body>
......
......@@ -21,6 +21,8 @@
<codeph>createlang</codeph> is a wrapper around the <codeph>SQL</codeph> command
<codeph><xref
href="../../ref_guide/sql_commands/CREATE_EXTENSION.xml#topic1"/></codeph>.</p>
<note><codeph>createlang</codeph> is deprecated and may be removed in a future release. Direct
use of the <codeph>CREATE EXTENSION</codeph> command is recommended instead.</note>
<p>The procedural language packages included in the standard Greenplum Database
distribution are:</p>
<ul>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册