Update documentation to reflect that standard PLs are now extensions.

Recommend use of CREATE EXTENSION rather than plain CREATE LANGUAGE
where relevant.  Encourage PL authors to provide extension wrappers
for their PLs.
This commit is contained in:
Tom Lane 2011-03-05 01:08:38 -05:00
parent 63b656b7bf
commit c2903fb3d2
8 changed files with 52 additions and 18 deletions

View File

@ -216,6 +216,15 @@ CREATE LANGUAGE plsample
should execute this code and return. should execute this code and return.
</para> </para>
<para>
It's recommended that you wrap all these function declarations,
as well as the <command>CREATE LANGUAGE</> command itself, into
an <firstterm>extension</> so that a simple <command>CREATE EXTENSION</>
command is sufficient to install the language. See
<xref linkend="extend-extensions"> for information about writing
extensions.
</para>
<para> <para>
The procedural languages included in the standard distribution The procedural languages included in the standard distribution
are good references when trying to write your own language handler. are good references when trying to write your own language handler.

View File

@ -27,6 +27,7 @@
<para> <para>
To install PL/Perl in a particular database, use To install PL/Perl in a particular database, use
<literal>CREATE EXTENSION plperl</>, or from the shell command line use
<literal>createlang plperl <replaceable>dbname</></literal>. <literal>createlang plperl <replaceable>dbname</></literal>.
</para> </para>
@ -967,8 +968,7 @@ $$ LANGUAGE plperl;
mail. To handle these cases, PL/Perl can also be installed as an mail. To handle these cases, PL/Perl can also be installed as an
<quote>untrusted</> language (usually called <quote>untrusted</> language (usually called
<application>PL/PerlU</application><indexterm><primary>PL/PerlU</></indexterm>). <application>PL/PerlU</application><indexterm><primary>PL/PerlU</></indexterm>).
In this case the full Perl language is available. If the In this case the full Perl language is available. When installing the
<command>createlang</command> program is used to install the
language, the language name <literal>plperlu</literal> will select language, the language name <literal>plperlu</literal> will select
the untrusted PL/Perl variant. the untrusted PL/Perl variant.
</para> </para>

View File

@ -14,6 +14,7 @@
<para> <para>
To install PL/Python in a particular database, use To install PL/Python in a particular database, use
<literal>CREATE EXTENSION plpythonu</>, or from the shell command line use
<literal>createlang plpythonu <replaceable>dbname</></literal> (but <literal>createlang plpythonu <replaceable>dbname</></literal> (but
see also <xref linkend="plpython-python23">). see also <xref linkend="plpython-python23">).
</para> </para>

View File

@ -66,6 +66,7 @@
directory if Tcl support is specified in the configuration step of directory if Tcl support is specified in the configuration step of
the installation procedure. To install <application>PL/Tcl</> the installation procedure. To install <application>PL/Tcl</>
and/or <application>PL/TclU</> in a particular database, use the and/or <application>PL/TclU</> in a particular database, use the
<command>CREATE EXTENSION</> command or the
<command>createlang</command> program, for example <command>createlang</command> program, for example
<literal>createlang pltcl <replaceable>dbname</></literal> or <literal>createlang pltcl <replaceable>dbname</></literal> or
<literal>createlang pltclu <replaceable>dbname</></literal>. <literal>createlang pltclu <replaceable>dbname</></literal>.

View File

@ -37,6 +37,21 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="pa
defined in this new language. defined in this new language.
</para> </para>
<note>
<para>
As of <productname>PostgreSQL</productname> 9.1, most procedural
languages have been made into <quote>extensions</>, and should
therefore be installed with <xref linkend="sql-createextension">
not <command>CREATE LANGUAGE</command>. Direct use of
<command>CREATE LANGUAGE</command> should now be confined to
extension installation scripts. If you have a <quote>bare</>
language in your database, perhaps as a result of an upgrade,
you can convert it to an extension using
<literal>CREATE EXTENSION <replaceable>langname</> FROM
unpackaged</literal>.
</para>
</note>
<para> <para>
<command>CREATE LANGUAGE</command> effectively associates the <command>CREATE LANGUAGE</command> effectively associates the
language name with handler function(s) that are responsible for executing language name with handler function(s) that are responsible for executing

View File

@ -33,6 +33,15 @@ DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] <replaceable class="PARAMETER">name</
previously registered procedural language. You must be a superuser previously registered procedural language. You must be a superuser
or the owner of the language to use <command>DROP LANGUAGE</>. or the owner of the language to use <command>DROP LANGUAGE</>.
</para> </para>
<note>
<para>
As of <productname>PostgreSQL</productname> 9.1, most procedural
languages have been made into <quote>extensions</>, and should
therefore be removed with <xref linkend="sql-dropextension">
not <command>DROP LANGUAGE</command>.
</para>
</note>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@ -54,7 +54,7 @@
<para> <para>
For the languages supplied with the standard distribution, it is For the languages supplied with the standard distribution, it is
only necessary to execute <command>CREATE LANGUAGE</> only necessary to execute <command>CREATE EXTENSION</>
<replaceable>language_name</> to install the language into the <replaceable>language_name</> to install the language into the
current database. Alternatively, the program <xref current database. Alternatively, the program <xref
linkend="app-createlang"> can be used to do this from the shell linkend="app-createlang"> can be used to do this from the shell
@ -65,8 +65,7 @@
createlang plperl template1 createlang plperl template1
</programlisting> </programlisting>
The manual procedure described below is only recommended for The manual procedure described below is only recommended for
installing custom languages that <command>CREATE LANGUAGE</command> installing languages that have not been packaged as extensions.
does not know about.
</para> </para>
<procedure> <procedure>
@ -76,10 +75,10 @@ createlang plperl template1
<para> <para>
A procedural language is installed in a database in five steps, A procedural language is installed in a database in five steps,
which must be carried out by a database superuser. (For languages which must be carried out by a database superuser. In most cases
known to <command>CREATE LANGUAGE</>, the second through fourth steps the required SQL commands should be packaged as the installation script
can be omitted, because they will be carried out automatically of an <quote>extension</>, so that <command>CREATE EXTENSION</> can be
if needed.) used to execute them.
</para> </para>
<step performance="required" id="xplang-install-cr1"> <step performance="required" id="xplang-install-cr1">
@ -136,14 +135,14 @@ CREATE FUNCTION <replaceable>inline_function_name</replaceable>(internal)
CREATE FUNCTION <replaceable>validator_function_name</replaceable>(oid) CREATE FUNCTION <replaceable>validator_function_name</replaceable>(oid)
RETURNS void RETURNS void
AS '<replaceable>path-to-shared-object</replaceable>' AS '<replaceable>path-to-shared-object</replaceable>'
LANGUAGE C; LANGUAGE C STRICT;
</synopsis> </synopsis>
</para> </para>
</step> </step>
<step performance="required" id="xplang-install-cr5"> <step performance="required" id="xplang-install-cr5">
<para> <para>
The PL must be declared with the command Finally, the PL must be declared with the command
<synopsis> <synopsis>
CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <replaceable>language-name</replaceable> CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <replaceable>language-name</replaceable>
HANDLER <replaceable>handler_function_name</replaceable> HANDLER <replaceable>handler_function_name</replaceable>
@ -154,7 +153,7 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re
the language does not grant access to data that the user would the language does not grant access to data that the user would
not otherwise have. Trusted languages are designed for ordinary not otherwise have. Trusted languages are designed for ordinary
database users (those without superuser privilege) and allows them database users (those without superuser privilege) and allows them
to safely create of functions and trigger to safely create functions and trigger
procedures. Since PL functions are executed inside the database procedures. Since PL functions are executed inside the database
server, the <literal>TRUSTED</literal> flag should only be given server, the <literal>TRUSTED</literal> flag should only be given
for languages that do not allow access to database server for languages that do not allow access to database server
@ -201,7 +200,7 @@ CREATE FUNCTION plperl_inline_handler(internal) RETURNS void AS
'$libdir/plperl' LANGUAGE C; '$libdir/plperl' LANGUAGE C;
CREATE FUNCTION plperl_validator(oid) RETURNS void AS CREATE FUNCTION plperl_validator(oid) RETURNS void AS
'$libdir/plperl' LANGUAGE C; '$libdir/plperl' LANGUAGE C STRICT;
</programlisting> </programlisting>
</para> </para>