mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Revise handling of oldstyle/newstyle functions per recent discussions
in pghackers list. Support for oldstyle internal functions is gone (no longer needed, since conversion is complete) and pg_language entry 'internal' now implies newstyle call convention. pg_language entry 'newC' is gone; both old and newstyle dynamically loaded C functions are now called language 'C'. A newstyle function must be identified by an associated info routine. See src/backend/utils/fmgr/README.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.19 2000/11/02 19:26:44 momjian Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.20 2000/11/20 20:36:46 tgl Exp $
|
||||
Postgres documentation
|
||||
-->
|
||||
|
||||
@@ -119,8 +119,7 @@ CREATE FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceab
|
||||
<listitem>
|
||||
<para>
|
||||
May be '<literal>sql</literal>',
|
||||
'<literal>C</literal>', '<literal>newC</literal>',
|
||||
'<literal>internal</literal>', '<literal>newinternal</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
|
||||
@@ -258,7 +257,7 @@ CREATE
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Two <literal>internal</literal> or <literal>newinternal</literal>
|
||||
Two <literal>internal</literal>
|
||||
functions cannot have the same C name without causing
|
||||
errors at link time. To get around that, give them different C names
|
||||
(for example, use the argument types as part of the C names), then
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.13 2000/11/04 21:04:54 momjian Exp $
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.14 2000/11/20 20:36:46 tgl Exp $
|
||||
Postgres documentation
|
||||
-->
|
||||
|
||||
@@ -163,7 +163,8 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
|
||||
<note>
|
||||
<para>
|
||||
In <productname>Postgres</productname> 7.1 and later, call handlers
|
||||
must adhere to the "new style" function manager interface.
|
||||
must adhere to the "version 1" function manager interface, not the
|
||||
old-style interface.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
@@ -180,7 +181,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The call handler is called in the same way as any other new-style
|
||||
The call handler is called in the same way as any other
|
||||
function: it receives a pointer to a FunctionCallInfoData struct
|
||||
containing argument values and information about the called function,
|
||||
and it is expected to return a Datum result (and possibly set the
|
||||
@@ -269,9 +270,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
|
||||
lanname | lanispl | lanpltrusted | lanplcallfoid | lancompiler
|
||||
-------------+---------+--------------+---------------+-------------
|
||||
internal | f | f | 0 | n/a
|
||||
newinternal | f | f | 0 | n/a
|
||||
C | f | f | 0 | /bin/cc
|
||||
newC | f | f | 0 | /bin/cc
|
||||
sql | f | f | 0 | postgres
|
||||
</computeroutput>
|
||||
</programlisting>
|
||||
@@ -279,8 +278,9 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
|
||||
|
||||
<para>
|
||||
The call handler for a procedural language must normally be written
|
||||
in C and registered as 'newinternal' or 'newC' language, depending
|
||||
in C and registered as 'internal' or 'C' language, depending
|
||||
on whether it is linked into the backend or dynamically loaded.
|
||||
The call handler cannot use the old-style 'C' function interface.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -306,6 +306,8 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
|
||||
#include "catalog/pg_proc.h"
|
||||
#include "catalog/pg_type.h"
|
||||
|
||||
PG_FUNCTION_INFO_V1(plsample_call_handler);
|
||||
|
||||
Datum
|
||||
plsample_call_handler(PG_FUNCTION_ARGS)
|
||||
{
|
||||
@@ -344,7 +346,7 @@ plsample_call_handler(PG_FUNCTION_ARGS)
|
||||
<programlisting>
|
||||
CREATE FUNCTION plsample_call_handler () RETURNS opaque
|
||||
AS '/usr/local/pgsql/lib/plsample.so'
|
||||
LANGUAGE 'newC';
|
||||
LANGUAGE 'C';
|
||||
CREATE PROCEDURAL LANGUAGE 'plsample'
|
||||
HANDLER plsample_call_handler
|
||||
LANCOMPILER 'PL/Sample';
|
||||
|
||||
Reference in New Issue
Block a user