Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c2903fb

Browse files
committed
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.
1 parent 63b656b commit c2903fb

8 files changed

+52
-18
lines changed

doc/src/sgml/installation.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2601,8 +2601,8 @@ cc-1020 cc: ERROR File = pqcomm.c, Line = 427
26012601
<para>
26022602
To build 64 bit binaries using MinGW, install the 64 bit tool set
26032603
from <ulink url="http://mingw-w64.sourceforge.net/"></ulink>, put its bin
2604-
directory in the <envar>PATH</envar>, and run
2605-
<command>configure</command> with the
2604+
directory in the <envar>PATH</envar>, and run
2605+
<command>configure</command> with the
26062606
<command>--host=x86_64-w64-mingw</command> option.
26072607
</para>
26082608

doc/src/sgml/plhandler.sgml

+9
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ CREATE LANGUAGE plsample
216216
should execute this code and return.
217217
</para>
218218

219+
<para>
220+
It's recommended that you wrap all these function declarations,
221+
as well as the <command>CREATE LANGUAGE</> command itself, into
222+
an <firstterm>extension</> so that a simple <command>CREATE EXTENSION</>
223+
command is sufficient to install the language. See
224+
<xref linkend="extend-extensions"> for information about writing
225+
extensions.
226+
</para>
227+
219228
<para>
220229
The procedural languages included in the standard distribution
221230
are good references when trying to write your own language handler.

doc/src/sgml/plperl.sgml

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
<para>
2929
To install PL/Perl in a particular database, use
30+
<literal>CREATE EXTENSION plperl</>, or from the shell command line use
3031
<literal>createlang plperl <replaceable>dbname</></literal>.
3132
</para>
3233

@@ -127,9 +128,9 @@ $$ LANGUAGE plperl;
127128

128129
<note>
129130
<para>
130-
Arguments will be converted from the database's encoding to UTF-8
131-
for use inside plperl, and then converted from UTF-8 back to the
132-
database encoding upon return.
131+
Arguments will be converted from the database's encoding to UTF-8
132+
for use inside plperl, and then converted from UTF-8 back to the
133+
database encoding upon return.
133134
</para>
134135
</note>
135136

@@ -967,8 +968,7 @@ $$ LANGUAGE plperl;
967968
mail. To handle these cases, PL/Perl can also be installed as an
968969
<quote>untrusted</> language (usually called
969970
<application>PL/PerlU</application><indexterm><primary>PL/PerlU</></indexterm>).
970-
In this case the full Perl language is available. If the
971-
<command>createlang</command> program is used to install the
971+
In this case the full Perl language is available. When installing the
972972
language, the language name <literal>plperlu</literal> will select
973973
the untrusted PL/Perl variant.
974974
</para>

doc/src/sgml/plpython.sgml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

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

doc/src/sgml/pltcl.sgml

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
directory if Tcl support is specified in the configuration step of
6767
the installation procedure. To install <application>PL/Tcl</>
6868
and/or <application>PL/TclU</> in a particular database, use the
69+
<command>CREATE EXTENSION</> command or the
6970
<command>createlang</command> program, for example
7071
<literal>createlang pltcl <replaceable>dbname</></literal> or
7172
<literal>createlang pltclu <replaceable>dbname</></literal>.

doc/src/sgml/ref/create_language.sgml

+15
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="pa
3737
defined in this new language.
3838
</para>
3939

40+
<note>
41+
<para>
42+
As of <productname>PostgreSQL</productname> 9.1, most procedural
43+
languages have been made into <quote>extensions</>, and should
44+
therefore be installed with <xref linkend="sql-createextension">
45+
not <command>CREATE LANGUAGE</command>. Direct use of
46+
<command>CREATE LANGUAGE</command> should now be confined to
47+
extension installation scripts. If you have a <quote>bare</>
48+
language in your database, perhaps as a result of an upgrade,
49+
you can convert it to an extension using
50+
<literal>CREATE EXTENSION <replaceable>langname</> FROM
51+
unpackaged</literal>.
52+
</para>
53+
</note>
54+
4055
<para>
4156
<command>CREATE LANGUAGE</command> effectively associates the
4257
language name with handler function(s) that are responsible for executing

doc/src/sgml/ref/drop_language.sgml

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] <replaceable class="PARAMETER">name</
3333
previously registered procedural language. You must be a superuser
3434
or the owner of the language to use <command>DROP LANGUAGE</>.
3535
</para>
36+
37+
<note>
38+
<para>
39+
As of <productname>PostgreSQL</productname> 9.1, most procedural
40+
languages have been made into <quote>extensions</>, and should
41+
therefore be removed with <xref linkend="sql-dropextension">
42+
not <command>DROP LANGUAGE</command>.
43+
</para>
44+
</note>
3645
</refsect1>
3746

3847
<refsect1>

doc/src/sgml/xplang.sgml

+10-11
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<para>
5656
For the languages supplied with the standard distribution, it is
57-
only necessary to execute <command>CREATE LANGUAGE</>
57+
only necessary to execute <command>CREATE EXTENSION</>
5858
<replaceable>language_name</> to install the language into the
5959
current database. Alternatively, the program <xref
6060
linkend="app-createlang"> can be used to do this from the shell
@@ -65,8 +65,7 @@
6565
createlang plperl template1
6666
</programlisting>
6767
The manual procedure described below is only recommended for
68-
installing custom languages that <command>CREATE LANGUAGE</command>
69-
does not know about.
68+
installing languages that have not been packaged as extensions.
7069
</para>
7170

7271
<procedure>
@@ -76,10 +75,10 @@ createlang plperl template1
7675

7776
<para>
7877
A procedural language is installed in a database in five steps,
79-
which must be carried out by a database superuser. (For languages
80-
known to <command>CREATE LANGUAGE</>, the second through fourth steps
81-
can be omitted, because they will be carried out automatically
82-
if needed.)
78+
which must be carried out by a database superuser. In most cases
79+
the required SQL commands should be packaged as the installation script
80+
of an <quote>extension</>, so that <command>CREATE EXTENSION</> can be
81+
used to execute them.
8382
</para>
8483

8584
<step performance="required" id="xplang-install-cr1">
@@ -136,14 +135,14 @@ CREATE FUNCTION <replaceable>inline_function_name</replaceable>(internal)
136135
CREATE FUNCTION <replaceable>validator_function_name</replaceable>(oid)
137136
RETURNS void
138137
AS '<replaceable>path-to-shared-object</replaceable>'
139-
LANGUAGE C;
138+
LANGUAGE C STRICT;
140139
</synopsis>
141140
</para>
142141
</step>
143142

144143
<step performance="required" id="xplang-install-cr5">
145144
<para>
146-
The PL must be declared with the command
145+
Finally, the PL must be declared with the command
147146
<synopsis>
148147
CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <replaceable>language-name</replaceable>
149148
HANDLER <replaceable>handler_function_name</replaceable>
@@ -154,7 +153,7 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re
154153
the language does not grant access to data that the user would
155154
not otherwise have. Trusted languages are designed for ordinary
156155
database users (those without superuser privilege) and allows them
157-
to safely create of functions and trigger
156+
to safely create functions and trigger
158157
procedures. Since PL functions are executed inside the database
159158
server, the <literal>TRUSTED</literal> flag should only be given
160159
for languages that do not allow access to database server
@@ -201,7 +200,7 @@ CREATE FUNCTION plperl_inline_handler(internal) RETURNS void AS
201200
'$libdir/plperl' LANGUAGE C;
202201

203202
CREATE FUNCTION plperl_validator(oid) RETURNS void AS
204-
'$libdir/plperl' LANGUAGE C;
203+
'$libdir/plperl' LANGUAGE C STRICT;
205204
</programlisting>
206205
</para>
207206

0 commit comments

Comments
 (0)