Commit 62651c01 authored by Tom Lane's avatar Tom Lane

Editorial work on xfunc chapter --- better explanations about SQL

functions handling composite types and sets, various minor cleanups.
parent b93939a6
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.14 2001/05/19 09:01:10 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.15 2001/10/26 19:58:12 tgl Exp $
--> -->
<sect2 id="dfunc"> <sect2 id="dfunc">
...@@ -7,9 +7,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.14 2001/05/19 09:01:10 peter ...@@ -7,9 +7,9 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.14 2001/05/19 09:01:10 peter
<para> <para>
Before you are able to use your Before you are able to use your
<productname>PostgreSQL</productname> extension function written in <productname>PostgreSQL</productname> extension functions written in
C they need to be compiled and linked in a special way in order to C, they must be compiled and linked in a special way to produce a file
allow it to be dynamically loaded as needed by the server. To be that can be dynamically loaded by the server. To be
precise, a <firstterm>shared library</firstterm> needs to be created. precise, a <firstterm>shared library</firstterm> needs to be created.
</para> </para>
...@@ -31,7 +31,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.14 2001/05/19 09:01:10 peter ...@@ -31,7 +31,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.14 2001/05/19 09:01:10 peter
be created as <firstterm>position-independent code</firstterm> be created as <firstterm>position-independent code</firstterm>
(<acronym>PIC</acronym>), which conceptually means that they can be (<acronym>PIC</acronym>), which conceptually means that they can be
placed at an arbitrary location in memory when they are loaded by the placed at an arbitrary location in memory when they are loaded by the
executable. (Object files intended for executables are not compiled executable. (Object files intended for executables are usually not compiled
that way.) The command to link a shared library contains special that way.) The command to link a shared library contains special
flags to distinguish it from linking an executable. --- At least flags to distinguish it from linking an executable. --- At least
this is the theory. On some systems the practice is much uglier. this is the theory. On some systems the practice is much uglier.
...@@ -263,16 +263,14 @@ gcc -shared -o foo.so foo.o ...@@ -263,16 +263,14 @@ gcc -shared -o foo.so foo.o
The resulting shared library file can then be loaded into The resulting shared library file can then be loaded into
<productname>Postgres</productname>. When specifying the file name <productname>Postgres</productname>. When specifying the file name
to the <command>CREATE FUNCTION</command> command, one must give it to the <command>CREATE FUNCTION</command> command, one must give it
the name of the shared library file (ending in the name of the shared library file, not the intermediate object file.
<filename>.so</filename>) rather than the intermediate object file. Note that the system's standard shared-library extension (usually
<literal>.so</literal> or <literal>.sl</literal>) can be omitted from
<note> the <command>CREATE FUNCTION</command> command, and normally should
<para> be omitted for best portability.
Actually, <productname>Postgres</productname> does not care what </para>
you name the file as long as it is a shared library file.
</para>
</note>
<para>
Refer back to <xref linkend="xfunc-c-dynload"> about where the Refer back to <xref linkend="xfunc-c-dynload"> about where the
server expects to find the shared library files. server expects to find the shared library files.
</para> </para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.9 2001/09/03 12:57:50 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.10 2001/10/26 19:58:12 tgl Exp $
--> -->
<refentry id="SQL-LOAD"> <refentry id="SQL-LOAD">
...@@ -10,7 +10,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.9 2001/09/03 12:57:50 pet ...@@ -10,7 +10,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/load.sgml,v 1.9 2001/09/03 12:57:50 pet
<refnamediv> <refnamediv>
<refname>LOAD</refname> <refname>LOAD</refname>
<refpurpose>load or reload a shared object file</refpurpose> <refpurpose>load or reload a shared library file</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
...@@ -23,13 +23,22 @@ LOAD '<replaceable class="PARAMETER">filename</replaceable>' ...@@ -23,13 +23,22 @@ LOAD '<replaceable class="PARAMETER">filename</replaceable>'
<title>Description</title> <title>Description</title>
<para> <para>
Loads a shared object file into the PostgreSQL backend's address Loads a shared library file into the PostgreSQL backend's address
space. If the file had been loaded previously, it is first space. If the file had been loaded previously, it is first
unloaded. This command is primarily useful to unload and reload a unloaded. This command is primarily useful to unload and reload a
shared object file if it has been changed. To make use of the shared library file that has been changed since the backend first
shared object, a function needs to be declared using the <xref loaded it. To make use of the
shared library, function(s) in it need to be declared using the <xref
linkend="sql-createfunction"> command. linkend="sql-createfunction"> command.
</para> </para>
<para>
The filename is specified in the same way as for shared library
names in <xref linkend="sql-createfunction">; in particular, one
may rely on a search path and automatic addition of the system's standard
shared library filename extension. See the
<citetitle>Programmer's Guide</citetitle> for more detail.
</para>
</refsect1> </refsect1>
<refsect1 id="sql-load-compat"> <refsect1 id="sql-load-compat">
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment