mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Make LANCOMPILER clause in CREATE LANGUAGE optional. Allow "identifier"
syntax for language names (instead of 'string'). createlang now handles the case where a second language uses the same call handler as an already installed language (e.g., plperl/plperlu). droplang now handles the reverse case, i.e., dropping a language where the call handler is still used by another language. Moreover, droplang can now be used to drop any user-defined language, not just the supplied ones.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.24 2001/06/04 23:27:23 momjian Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.25 2001/08/13 21:34:51 petere Exp $
|
||||
-->
|
||||
|
||||
<refentry id="SQL-CREATEFUNCTION">
|
||||
@ -18,12 +18,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.24 2001/06/04
|
||||
CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">argtype</replaceable> [, ...] ] )
|
||||
RETURNS <replaceable class="parameter">rettype</replaceable>
|
||||
AS '<replaceable class="parameter">definition</replaceable>'
|
||||
LANGUAGE '<replaceable class="parameter">langname</replaceable>'
|
||||
LANGUAGE <replaceable class="parameter">langname</replaceable>
|
||||
[ WITH ( <replaceable class="parameter">attribute</replaceable> [, ...] ) ]
|
||||
CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">argtype</replaceable> [, ...] ] )
|
||||
RETURNS <replaceable class="parameter">rettype</replaceable>
|
||||
AS '<replaceable class="parameter">obj_file</replaceable>', '<replaceable class="parameter">link_symbol</replaceable>'
|
||||
LANGUAGE '<replaceable class="parameter">langname</replaceable>'
|
||||
LANGUAGE <replaceable class="parameter">langname</replaceable>
|
||||
[ WITH ( <replaceable class="parameter">attribute</replaceable> [, ...] ) ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
@ -123,13 +123,14 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
May be '<literal>sql</literal>', '<literal>C</literal>',
|
||||
'<literal>internal</literal>', or '<replaceable
|
||||
class="parameter">plname</replaceable>', where '<replaceable
|
||||
class="parameter">plname</replaceable>' is the name of a
|
||||
May be <literal>SQL</literal>, <literal>C</literal>,
|
||||
<literal>internal</literal>, or <replaceable
|
||||
class="parameter">plname</replaceable>, where <replaceable
|
||||
class="parameter">plname</replaceable> is the name of a
|
||||
created procedural language. See
|
||||
<xref linkend="sql-createlanguage">
|
||||
for details.
|
||||
for details. For backward compatibility, the name may be
|
||||
enclosed by single quotes.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -261,7 +262,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
|
||||
<programlisting>
|
||||
CREATE FUNCTION one() RETURNS integer
|
||||
AS 'SELECT 1 AS RESULT;'
|
||||
LANGUAGE 'sql';
|
||||
LANGUAGE SQL;
|
||||
|
||||
SELECT one() AS answer;
|
||||
<computeroutput>
|
||||
@ -281,7 +282,7 @@ SELECT one() AS answer;
|
||||
|
||||
<programlisting>
|
||||
CREATE FUNCTION ean_checkdigit(char, char) RETURNS boolean
|
||||
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c';
|
||||
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE C;
|
||||
|
||||
CREATE TABLE product (
|
||||
id char(8) PRIMARY KEY,
|
||||
@ -306,7 +307,7 @@ CREATE TABLE product (
|
||||
<programlisting>
|
||||
CREATE FUNCTION point(complex) RETURNS point
|
||||
AS '/home/bernie/pgsql/lib/complex.so', 'complex_to_point'
|
||||
LANGUAGE 'c';
|
||||
LANGUAGE C;
|
||||
</programlisting>
|
||||
|
||||
The C declaration of the function could be:
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.14 2000/11/20 20:36:46 tgl Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.15 2001/08/13 21:34:51 petere Exp $
|
||||
Postgres documentation
|
||||
-->
|
||||
|
||||
@ -23,9 +23,8 @@ Postgres documentation
|
||||
<date>1999-07-20</date>
|
||||
</refsynopsisdivinfo>
|
||||
<synopsis>
|
||||
CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE '<replaceable class="parameter">langname</replaceable>'
|
||||
CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langname</replaceable>
|
||||
HANDLER <replaceable class="parameter">call_handler</replaceable>
|
||||
LANCOMPILER '<replaceable class="parameter">comment</replaceable>'
|
||||
</synopsis>
|
||||
|
||||
<refsect2 id="R2-SQL-CREATELANGUAGE-1">
|
||||
@ -62,6 +61,10 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE '<replaceable class="parameter">langn
|
||||
language cannot override one of the built-in languages of
|
||||
<productname>Postgres</productname>.
|
||||
</para>
|
||||
<para>
|
||||
For backward compatibility, the name may be enclosed by single
|
||||
quotes.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@ -77,20 +80,6 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE '<replaceable class="parameter">langn
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">comment</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <function>LANCOMPILER</function> argument is the
|
||||
string that will be
|
||||
inserted in the <literal>LANCOMPILER</literal> attribute
|
||||
of the new
|
||||
<filename>pg_language</filename> entry. At present,
|
||||
<productname>Postgres</productname> does not use
|
||||
this attribute in any way.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
@ -346,10 +335,9 @@ plsample_call_handler(PG_FUNCTION_ARGS)
|
||||
<programlisting>
|
||||
CREATE FUNCTION plsample_call_handler () RETURNS opaque
|
||||
AS '/usr/local/pgsql/lib/plsample.so'
|
||||
LANGUAGE 'C';
|
||||
CREATE PROCEDURAL LANGUAGE 'plsample'
|
||||
HANDLER plsample_call_handler
|
||||
LANCOMPILER 'PL/Sample';
|
||||
LANGUAGE C;
|
||||
CREATE LANGUAGE plsample
|
||||
HANDLER plsample_call_handler;
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_language.sgml,v 1.9 2000/12/25 23:15:26 petere Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_language.sgml,v 1.10 2001/08/13 21:34:51 petere Exp $
|
||||
Postgres documentation
|
||||
-->
|
||||
|
||||
@ -23,7 +23,7 @@ Postgres documentation
|
||||
<date>1999-07-20</date>
|
||||
</refsynopsisdivinfo>
|
||||
<synopsis>
|
||||
DROP [ PROCEDURAL ] LANGUAGE '<replaceable class="PARAMETER">name</replaceable>'
|
||||
DROP [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">name</replaceable>
|
||||
</synopsis>
|
||||
|
||||
<refsect2 id="R2-SQL-DROPLANGUAGE-1">
|
||||
@ -40,7 +40,8 @@ DROP [ PROCEDURAL ] LANGUAGE '<replaceable class="PARAMETER">name</replaceable>'
|
||||
<term><replaceable class="PARAMETER">name</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The name of an existing procedural language.
|
||||
The name of an existing procedural language. For backward
|
||||
compatibility, the name may be enclosed by single quotes.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -132,7 +133,7 @@ ERROR: Language "<replaceable class="parameter">name</replaceable>" doesn't exis
|
||||
This command removes the PL/Sample language:
|
||||
|
||||
<programlisting>
|
||||
DROP PROCEDURAL LANGUAGE 'plsample';
|
||||
DROP LANGUAGE plsample;
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.13 2001/05/19 09:01:10 petere Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.14 2001/08/13 21:34:51 petere Exp $
|
||||
-->
|
||||
|
||||
<chapter id="xplang">
|
||||
@ -79,7 +79,7 @@ createlang plpgsql template1
|
||||
<synopsis>
|
||||
CREATE FUNCTION <replaceable>handler_function_name</replaceable> ()
|
||||
RETURNS OPAQUE AS
|
||||
'<replaceable>path-to-shared-object</replaceable>' LANGUAGE 'C';
|
||||
'<replaceable>path-to-shared-object</replaceable>' LANGUAGE C;
|
||||
</synopsis>
|
||||
The special return type of <type>OPAQUE</type> tells
|
||||
the database that this function does not return one of
|
||||
@ -92,9 +92,8 @@ CREATE FUNCTION <replaceable>handler_function_name</replaceable> ()
|
||||
<para>
|
||||
The PL must be declared with the command
|
||||
<synopsis>
|
||||
CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE '<replaceable>language-name</replaceable>'
|
||||
HANDLER <replaceable>handler_function_name</replaceable>
|
||||
LANCOMPILER '<replaceable>description</replaceable>';
|
||||
CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <replaceable>language-name</replaceable>
|
||||
HANDLER <replaceable>handler_function_name</replaceable>;
|
||||
</synopsis>
|
||||
The optional key word <token>TRUSTED</token> tells
|
||||
whether ordinary database users that have no superuser
|
||||
@ -130,7 +129,7 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE '<r
|
||||
|
||||
<programlisting>
|
||||
CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS
|
||||
'$libdir/plpgsql' LANGUAGE 'C';
|
||||
'$libdir/plpgsql' LANGUAGE C;
|
||||
</programlisting>
|
||||
</para>
|
||||
</step>
|
||||
@ -139,9 +138,8 @@ CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS
|
||||
<para>
|
||||
The command
|
||||
<programlisting>
|
||||
CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql'
|
||||
HANDLER plpgsql_call_handler
|
||||
LANCOMPILER 'PL/pgSQL';
|
||||
CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql
|
||||
HANDLER plpgsql_call_handler;
|
||||
</programlisting>
|
||||
then defines that the previously declared call handler function
|
||||
should be invoked for functions and trigger procedures where the
|
||||
|
Reference in New Issue
Block a user