summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/create_language.sgml
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-09-22 23:43:43 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-09-22 23:43:43 +0000
commit9048b73184b6852b71faf4481b75ab5850a9cd1b (patch)
tree445092b67a93cf16300f72e41f14d8ad3443188f /doc/src/sgml/ref/create_language.sgml
parentd5a43ffde068d67409b494d812bd7e9f514db29c (diff)
Implement the DO statement to support execution of PL code without having
to create a function for it. Procedural languages now have an additional entry point, namely a function to execute an inline code block. This seemed a better design than trying to hide the transient-ness of the code from the PL. As of this patch, only plpgsql has an inline handler, but probably people will soon write handlers for the other standard PLs. In passing, remove the long-dead LANCOMPILER option of CREATE LANGUAGE. Petr Jelinek
Diffstat (limited to 'doc/src/sgml/ref/create_language.sgml')
-rw-r--r--doc/src/sgml/ref/create_language.sgml32
1 files changed, 27 insertions, 5 deletions
diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml
index ae02995e37f..4c0463ddec1 100644
--- a/doc/src/sgml/ref/create_language.sgml
+++ b/doc/src/sgml/ref/create_language.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/create_language.sgml,v 1.45 2008/11/14 10:22:46 petere Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/create_language.sgml,v 1.46 2009/09/22 23:43:37 tgl Exp $
PostgreSQL documentation
-->
@@ -23,7 +23,7 @@ PostgreSQL documentation
<synopsis>
CREATE [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</replaceable>
CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</replaceable>
- HANDLER <replaceable class="parameter">call_handler</replaceable> [ VALIDATOR <replaceable>valfunction</replaceable> ]
+ HANDLER <replaceable class="parameter">call_handler</replaceable> [ INLINE <replaceable class="parameter">inline_handler</replaceable> ] [ VALIDATOR <replaceable>valfunction</replaceable> ]
</synopsis>
</refsynopsisdiv>
@@ -133,7 +133,7 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</
<para>
<replaceable class="parameter">call_handler</replaceable> is
the name of a previously registered function that will be
- called to execute the procedural language functions. The call
+ called to execute the procedural language's functions. The call
handler for a procedural language must be written in a compiled
language such as C with version 1 call convention and
registered with <productname>PostgreSQL</productname> as a
@@ -145,6 +145,27 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</
</varlistentry>
<varlistentry>
+ <term><literal>INLINE</literal> <replaceable class="parameter">inline_handler</replaceable></term>
+
+ <listitem>
+ <para>
+ <replaceable class="parameter">inline_handler</replaceable> is the
+ name of a previously registered function that will be called
+ to execute an anonymous code block
+ (<xref linkend="sql-do" endterm="sql-do-title"> command)
+ in this language.
+ If no <replaceable class="parameter">inline_handler</replaceable>
+ function is specified, the language does not support anonymous code
+ blocks.
+ The handler function must take one argument of
+ type <type>internal</type>, which will be the <command>DO</> command's
+ internal representation, and it will typically return
+ <type>void</>. The return value of the handler is ignored.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><literal>VALIDATOR</literal> <replaceable class="parameter">valfunction</replaceable></term>
<listitem>
@@ -216,7 +237,8 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</
</para>
<para>
- The call handler function and the validator function (if any)
+ The call handler function, the inline handler function (if any),
+ and the validator function (if any)
must already exist if the server does not have an entry for the language
in <structname>pg_pltemplate</>. But when there is an entry,
the functions need not already exist;
@@ -230,7 +252,7 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</
In <productname>PostgreSQL</productname> versions before 7.3, it was
necessary to declare handler functions as returning the placeholder
type <type>opaque</>, rather than <type>language_handler</>.
- To support loading
+ To support loading
of old dump files, <command>CREATE LANGUAGE</> will accept a function
declared as returning <type>opaque</>, but it will issue a notice and
change the function's declared return type to <type>language_handler</>.