Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
a8cb3368
Commit
a8cb3368
authored
Apr 07, 2003
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
General editing
parent
cb1d036a
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1388 additions
and
1710 deletions
+1388
-1710
doc/src/sgml/datetime.sgml
doc/src/sgml/datetime.sgml
+2
-2
doc/src/sgml/jdbc.sgml
doc/src/sgml/jdbc.sgml
+303
-299
doc/src/sgml/plperl.sgml
doc/src/sgml/plperl.sgml
+14
-10
doc/src/sgml/plpgsql.sgml
doc/src/sgml/plpgsql.sgml
+791
-1126
doc/src/sgml/plpython.sgml
doc/src/sgml/plpython.sgml
+39
-35
doc/src/sgml/pltcl.sgml
doc/src/sgml/pltcl.sgml
+179
-178
doc/src/sgml/pygresql.sgml
doc/src/sgml/pygresql.sgml
+22
-27
doc/src/sgml/xplang.sgml
doc/src/sgml/xplang.sgml
+38
-33
No files found.
doc/src/sgml/datetime.sgml
View file @
a8cb3368
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.3
0 2003/03/13 01:30:27
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.3
1 2003/04/07 01:29:25
petere Exp $
-->
-->
<appendix id="datetime-appendix">
<appendix id="datetime-appendix">
...
@@ -210,7 +210,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.30 2003/03/13 01:30:27 pe
...
@@ -210,7 +210,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datetime.sgml,v 2.30 2003/03/13 01:30:27 pe
</sect1>
</sect1>
<sect1>
<sect1
id="datetime-keywords"
>
<title>Date/Time Key Words</title>
<title>Date/Time Key Words</title>
<para>
<para>
...
...
doc/src/sgml/jdbc.sgml
View file @
a8cb3368
This diff is collapsed.
Click to expand it.
doc/src/sgml/plperl.sgml
View file @
a8cb3368
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.1
8 2002/09/21 18:32:53
petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.1
9 2003/04/07 01:29:25
petere Exp $
-->
-->
<chapter id="plperl">
<chapter id="plperl">
...
@@ -34,8 +34,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.18 2002/09/21 18:32:53 pete
...
@@ -34,8 +34,8 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plperl.sgml,v 2.18 2002/09/21 18:32:53 pete
<note>
<note>
<para>
<para>
Users of source packages must specially enable the build of
Users of source packages must specially enable the build of
PL/Perl during the installation process
(r
efer to the installation
PL/Perl during the installation process
. (R
efer to the installation
instructions for more information
).
Users of binary packages
instructions for more information
.)
Users of binary packages
might find PL/Perl in a separate subpackage.
might find PL/Perl in a separate subpackage.
</para>
</para>
</note>
</note>
...
@@ -57,8 +57,12 @@ CREATE FUNCTION <replaceable>funcname</replaceable> (<replaceable>argument-types
...
@@ -57,8 +57,12 @@ CREATE FUNCTION <replaceable>funcname</replaceable> (<replaceable>argument-types
Arguments and results are handled as in any other Perl subroutine:
Arguments and results are handled as in any other Perl subroutine:
Arguments are passed in <varname>@_</varname>, and a result value
Arguments are passed in <varname>@_</varname>, and a result value
is returned with <literal>return</> or as the last expression
is returned with <literal>return</> or as the last expression
evaluated in the function. For example, a function returning the
evaluated in the function.
greater of two integer values could be defined as:
</para>
<para>
For example, a function returning the greater of two integer values
could be defined as:
<programlisting>
<programlisting>
CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS '
CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS '
...
@@ -145,7 +149,7 @@ SELECT name, empcomp(employee) FROM employee;
...
@@ -145,7 +149,7 @@ SELECT name, empcomp(employee) FROM employee;
<title>Data Values in PL/Perl</title>
<title>Data Values in PL/Perl</title>
<para>
<para>
The argument values supplied to a PL/Perl function's
script
are
The argument values supplied to a PL/Perl function's
code
are
simply the input arguments converted to text form (just as if they
simply the input arguments converted to text form (just as if they
had been displayed by a <literal>SELECT</literal> statement).
had been displayed by a <literal>SELECT</literal> statement).
Conversely, the <literal>return</> command will accept any string
Conversely, the <literal>return</> command will accept any string
...
@@ -206,8 +210,8 @@ SELECT name, empcomp(employee) FROM employee;
...
@@ -206,8 +210,8 @@ SELECT name, empcomp(employee) FROM employee;
environment. This includes file handle operations,
environment. This includes file handle operations,
<literal>require</literal>, and <literal>use</literal> (for
<literal>require</literal>, and <literal>use</literal> (for
external modules). There is no way to access internals of the
external modules). There is no way to access internals of the
database
backend
process or to gain OS-level access with the
database
server
process or to gain OS-level access with the
permissions of the
<productname>PostgreSQL</productname> user ID
,
permissions of the
server process
,
as a C function can do. Thus, any unprivileged database user may
as a C function can do. Thus, any unprivileged database user may
be permitted to use this language.
be permitted to use this language.
</para>
</para>
...
@@ -227,7 +231,7 @@ CREATE FUNCTION badfunc() RETURNS integer AS '
...
@@ -227,7 +231,7 @@ CREATE FUNCTION badfunc() RETURNS integer AS '
<para>
<para>
Sometimes it is desirable to write Perl functions that are not
Sometimes it is desirable to write Perl functions that are not
restricted
--- f
or example, one might want a Perl function that
restricted
. F
or example, one might want a Perl function that
sends mail. To handle these cases, PL/Perl can also be installed
sends mail. To handle these cases, PL/Perl can also be installed
as an <quote>untrusted</> language (usually called
as an <quote>untrusted</> language (usually called
<application>PL/PerlU</application>). In this case the full Perl language is
<application>PL/PerlU</application>). In this case the full Perl language is
...
@@ -255,7 +259,7 @@ CREATE FUNCTION badfunc() RETURNS integer AS '
...
@@ -255,7 +259,7 @@ CREATE FUNCTION badfunc() RETURNS integer AS '
<para>
<para>
The following features are currently missing from PL/Perl, but they
The following features are currently missing from PL/Perl, but they
would make welcome contributions
:
would make welcome contributions
.
<itemizedlist>
<itemizedlist>
<listitem>
<listitem>
...
...
doc/src/sgml/plpgsql.sgml
View file @
a8cb3368
This source diff could not be displayed because it is too large. You can
view the blob
instead.
doc/src/sgml/plpython.sgml
View file @
a8cb3368
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.1
5 2002/10/21 20:34:09 momjian
Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/plpython.sgml,v 1.1
6 2003/04/07 01:29:25 petere
Exp $ -->
<chapter id="plpython">
<chapter id="plpython">
<title>PL/Python - Python Procedural Language</title>
<title>PL/Python - Python Procedural Language</title>
...
@@ -17,11 +17,18 @@
...
@@ -17,11 +17,18 @@
<literal>createlang plpython <replaceable>dbname</></literal>.
<literal>createlang plpython <replaceable>dbname</></literal>.
</para>
</para>
<tip>
<para>
If a language is installed into <literal>template1</>, all subsequently
created databases will have the language installed automatically.
</para>
</tip>
<note>
<note>
<para>
<para>
Users of source packages must specially enable the build of
Users of source packages must specially enable the build of
PL/Python during the installation process
(r
efer to the
PL/Python during the installation process
. (R
efer to the
installation instructions for more information
).
Users of binary
installation instructions for more information
.)
Users of binary
packages might find PL/Python in a separate subpackage.
packages might find PL/Python in a separate subpackage.
</para>
</para>
</note>
</note>
...
@@ -30,11 +37,11 @@
...
@@ -30,11 +37,11 @@
<title>PL/Python Functions</title>
<title>PL/Python Functions</title>
<para>
<para>
The Python code you write gets transformed into a function. E.g.,
The Python code you write gets transformed into a
Python
function. E.g.,
<programlisting>
<programlisting>
CREATE FUNCTION myfunc(text) RETURNS text
CREATE FUNCTION myfunc(text) RETURNS text
AS 'return args[0]'
AS 'return args[0]'
LANGUAGE
'plpython'
;
LANGUAGE
plpython
;
</programlisting>
</programlisting>
gets transformed into
gets transformed into
...
@@ -49,7 +56,7 @@ def __plpython_procedure_myfunc_23456():
...
@@ -49,7 +56,7 @@ def __plpython_procedure_myfunc_23456():
<para>
<para>
If you do not provide a return value, Python returns the default
If you do not provide a return value, Python returns the default
<symbol>None</symbol>
which may or may not be what you want.
The
<symbol>None</symbol>
.
The
language module translates Python's <symbol>None</symbol> into the
language module translates Python's <symbol>None</symbol> into the
SQL null value.
SQL null value.
</para>
</para>
...
@@ -60,8 +67,8 @@ def __plpython_procedure_myfunc_23456():
...
@@ -60,8 +67,8 @@ def __plpython_procedure_myfunc_23456():
<function>myfunc</function> example, <varname>args[0]</> contains
<function>myfunc</function> example, <varname>args[0]</> contains
whatever was passed in as the text argument. For
whatever was passed in as the text argument. For
<literal>myfunc2(text, integer)</literal>, <varname>args[0]</>
<literal>myfunc2(text, integer)</literal>, <varname>args[0]</>
would contain the <type>text</type>
variable
and
would contain the <type>text</type>
argument
and
<varname>args[1]</varname> the <type>integer</type>
variable
.
<varname>args[1]</varname> the <type>integer</type>
argument
.
</para>
</para>
<para>
<para>
...
@@ -95,14 +102,14 @@ def __plpython_procedure_myfunc_23456():
...
@@ -95,14 +102,14 @@ def __plpython_procedure_myfunc_23456():
<literal>TD["level"]</> contains one of <literal>ROW</>,
<literal>TD["level"]</> contains one of <literal>ROW</>,
<literal>STATEMENT</>, and <literal>UNKNOWN</>.
<literal>STATEMENT</>, and <literal>UNKNOWN</>.
<literal>TD["name"]</> contains the trigger name, and
<literal>TD["name"]</> contains the trigger name, and
<literal>TD["relid"]</> contains the
relation
ID of the table on
<literal>TD["relid"]</> contains the
O
ID of the table on
which the trigger occurred. If the trigger was called with
which the trigger occurred. If the trigger was called with
arguments they are available in <literal>TD["args"][0]</> to
arguments they are available in <literal>TD["args"][0]</> to
<literal>TD["args"][(n-1)]</>.
<literal>TD["args"][(n-1)]</>.
</para>
</para>
<para>
<para>
If
the
<literal>TD["when"]</literal> is <literal>BEFORE</>, you may
If <literal>TD["when"]</literal> is <literal>BEFORE</>, you may
return <literal>None</literal> or <literal>"OK"</literal> from the
return <literal>None</literal> or <literal>"OK"</literal> from the
Python function to indicate the row is unmodified,
Python function to indicate the row is unmodified,
<literal>"SKIP"</> to abort the event, or <literal>"MODIFY"</> to
<literal>"SKIP"</> to abort the event, or <literal>"MODIFY"</> to
...
@@ -147,10 +154,10 @@ def __plpython_procedure_myfunc_23456():
...
@@ -147,10 +154,10 @@ def __plpython_procedure_myfunc_23456():
optional limit argument causes that query to be run and the result
optional limit argument causes that query to be run and the result
to be returned in a result object. The result object emulates a
to be returned in a result object. The result object emulates a
list or dictionary object. The result object can be accessed by
list or dictionary object. The result object can be accessed by
row number and
field
name. It has these additional methods:
row number and
column
name. It has these additional methods:
<function>nrows
()
</function> which returns the number of rows
<function>nrows</function> which returns the number of rows
returned by the query, and <function>status</function> which is the
returned by the query, and <function>status</function> which is the
<function>SPI_exec
</function> return variabl
e. The result object
<function>SPI_exec
()</function> return valu
e. The result object
can be modified.
can be modified.
</para>
</para>
...
@@ -161,27 +168,27 @@ rv = plpy.execute("SELECT * FROM my_table", 5)
...
@@ -161,27 +168,27 @@ rv = plpy.execute("SELECT * FROM my_table", 5)
</programlisting>
</programlisting>
returns up to 5 rows from <literal>my_table</literal>. If
returns up to 5 rows from <literal>my_table</literal>. If
<literal>my_table</literal> has a column
<literal>my_table</literal> has a column
<literal>my_
field
</literal>, it would be accessed as
<literal>my_
column
</literal>, it would be accessed as
<programlisting>
<programlisting>
foo = rv[i]["my_
field
"]
foo = rv[i]["my_
column
"]
</programlisting>
</programlisting>
</para>
</para>
<para>
<para>
The second function <function>plpy.prepare</function> is called
The second function, <function>plpy.prepare</function>, prepares the
with a query string and a list of argument types if you have bind
execution plan for a query. It is called with a query string and a
variables in the query. For example:
list of parameter types, if you have parameter references in the
query. For example:
<programlisting>
<programlisting>
plan = plpy.prepare("SELECT last_name FROM my_users WHERE first_name = $1", [ "text" ])
plan = plpy.prepare("SELECT last_name FROM my_users WHERE first_name = $1", [ "text" ])
</programlisting>
</programlisting>
<literal>text</literal> is the type of the variable you will be
<literal>text</literal> is the type of the variable you will be
passing
as
<literal>$1</literal>. After preparing a statement, you
passing
for
<literal>$1</literal>. After preparing a statement, you
use the function <function>plpy.execute</function> to run it:
use the function <function>plpy.execute</function> to run it:
<programlisting>
<programlisting>
rv = plpy.execute(plan, [ "name" ], 5)
rv = plpy.execute(plan, [ "name" ], 5)
</programlisting>
</programlisting>
The limit argument is optional in the call to
The third argument is the limit and is optional.
<function>plpy.execute</function>.
</para>
</para>
<para>
<para>
...
@@ -190,7 +197,7 @@ rv = plpy.execute(plan, [ "name" ], 5)
...
@@ -190,7 +197,7 @@ rv = plpy.execute(plan, [ "name" ], 5)
in the immediate termination of that function by the server; it is
in the immediate termination of that function by the server; it is
not possible to trap error conditions using Python <literal>try
not possible to trap error conditions using Python <literal>try
... catch</literal> constructs. For example, a syntax error in an
... catch</literal> constructs. For example, a syntax error in an
SQL statement passed to the <literal>plpy.execute
()
</literal> call
SQL statement passed to the <literal>plpy.execute</literal> call
will terminate the function. This behavior may be changed in a
will terminate the function. This behavior may be changed in a
future release.
future release.
</para>
</para>
...
@@ -199,22 +206,19 @@ rv = plpy.execute(plan, [ "name" ], 5)
...
@@ -199,22 +206,19 @@ rv = plpy.execute(plan, [ "name" ], 5)
When you prepare a plan using the PL/Python module it is
When you prepare a plan using the PL/Python module it is
automatically saved. Read the SPI documentation (<xref
automatically saved. Read the SPI documentation (<xref
linkend="spi">) for a description of what this means.
linkend="spi">) for a description of what this means.
</para>
<para>
In order to make effective use of this across function calls
In order to make effective use of this across function calls
one needs to use one of the persistent storage dictionaries
one needs to use one of the persistent storage dictionaries
<literal>SD</literal> or <literal>GD</literal>
,
see
<literal>SD</literal> or <literal>GD</literal>
(
see
<xref linkend="plpython-funcs">. For example:
<xref linkend="plpython-funcs">
)
. For example:
<programlisting>
<programlisting>
CREATE FUNCTION usesavedplan
( ) RETURNS TRIGGER
AS '
CREATE FUNCTION usesavedplan
() RETURNS trigger
AS '
if SD.has_key("plan"):
if SD.has_key("plan"):
plan = SD["plan"]
plan = SD["plan"]
else:
else:
plan = plpy.prepare("SELECT 1")
plan = plpy.prepare("SELECT 1")
SD["plan"] = plan
SD["plan"] = plan
# rest of function
# rest of function
' LANGUAGE
'plpython'
;
' LANGUAGE
plpython
;
</programlisting>
</programlisting>
</para>
</para>
</sect1>
</sect1>
...
...
doc/src/sgml/pltcl.sgml
View file @
a8cb3368
This diff is collapsed.
Click to expand it.
doc/src/sgml/pygresql.sgml
View file @
a8cb3368
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/Attic/pygresql.sgml,v 1.
9 2002/12/12 22:49:27 momjian
Exp $ -->
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/Attic/pygresql.sgml,v 1.
10 2003/04/07 01:29:25 petere
Exp $ -->
<chapter id="pygresql">
<chapter id="pygresql">
<title><application>PyGreSQL</application> - <application>Python</application> Interface</title>
<title><application>PyGreSQL</application> - <application>Python</application> Interface</title>
...
@@ -334,13 +334,10 @@ make && make install
...
@@ -334,13 +334,10 @@ make && make install
<acronym>API</acronym> at <ulink
<acronym>API</acronym> at <ulink
url="http://www.python.org/topics/database/DatabaseAPI-2.0.html"
url="http://www.python.org/topics/database/DatabaseAPI-2.0.html"
>http://www.python.org/topics/database/DatabaseAPI-2.0.html</ulink>.
>http://www.python.org/topics/database/DatabaseAPI-2.0.html</ulink>.
</para>
<para>
A tutorial-like introduction to the <acronym>DB-API</acronym> can be
A tutorial-like introduction to the <acronym>DB-API</acronym> can be
found at <ulink
found at <ulink
url="http://www2.linuxjournal.com/lj-issues/issue49/2605.html"
url="http://www2.linuxjournal.com/lj-issues/issue49/2605.html"
>http://www2.linuxjournal.com/lj-issues/issue49/2605.html</ulink>
>http://www2.linuxjournal.com/lj-issues/issue49/2605.html</ulink>
.
</para>
</para>
<sect1 id="pygresql-pg">
<sect1 id="pygresql-pg">
...
@@ -365,16 +362,15 @@ make && make install
...
@@ -365,16 +362,15 @@ make && make install
<listitem>
<listitem>
<para>
<para>
<classname>pgqueryobject</classname>
that
handles query results.
<classname>pgqueryobject</classname>
, which
handles query results.
</para>
</para>
</listitem>
</listitem>
</itemizedlist>
</itemizedlist>
</para>
</para>
<para>
<para>
If you want to see a simple example of the use of some of these
If you want to see a simple example of the use this module,
functions, see <ulink url="http://www.druid.net/rides"
see <ulink url="http://www.druid.net/rides"></ulink> where you can find a link at the
>http://www.druid.net/rides</ulink> where you can find a link at the
bottom to the actual <application>Python</application> code for the
bottom to the actual <application>Python</application> code for the
page.
page.
</para>
</para>
...
@@ -395,9 +391,9 @@ make && make install
...
@@ -395,9 +391,9 @@ make && make install
<term><varname>INV_WRITE</varname></term>
<term><varname>INV_WRITE</varname></term>
<listitem>
<listitem>
<para>
<para>
l
arge objects access modes, used by
L
arge objects access modes, used by
<function>(pgobject.)locreate</function> and
<function>(pgobject.)locreate</function> and
<function>(pglarge.)open</function>
.
<function>(pglarge.)open</function>
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -408,7 +404,7 @@ make && make install
...
@@ -408,7 +404,7 @@ make && make install
<term><varname>SEEK_END</varname></term>
<term><varname>SEEK_END</varname></term>
<listitem>
<listitem>
<para>
<para>
positional flags, used by <function>(pglarge.)seek</function>.
Positional flags, used by <function>(pglarge.)seek</function>
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -418,7 +414,7 @@ make && make install
...
@@ -418,7 +414,7 @@ make && make install
<term><varname>__version__</varname></term>
<term><varname>__version__</varname></term>
<listitem>
<listitem>
<para>
<para>
c
onstants that give the current version
C
onstants that give the current version
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -443,13 +439,13 @@ make && make install
...
@@ -443,13 +439,13 @@ make && make install
to handle general connection parameters without heavy code in your
to handle general connection parameters without heavy code in your
programs. You can prompt the user for a value, put it in the
programs. You can prompt the user for a value, put it in the
default variable, and forget it, without having to modify your
default variable, and forget it, without having to modify your
environment. The support for default variables can be disabled by
environment. The support for default variables can be disabled
at build time
by
setting the <option>-DNO_DEF_VAR</option> option in the Python
setting the <option>-DNO_DEF_VAR</option> option in the Python
<filename>Setup</> file. Methods relative to this are specified by the tag [DV].
<filename>Setup</> file. Methods relative to this are specified by the tag [DV].
</para>
</para>
<para>
<para>
All
variabl
es are set to <symbol>None</symbol> at module
All
default valu
es are set to <symbol>None</symbol> at module
initialization, specifying that standard environment variables
initialization, specifying that standard environment variables
should be used.
should be used.
</para>
</para>
...
@@ -478,7 +474,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -478,7 +474,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<term><parameter>dbname</parameter></term>
<term><parameter>dbname</parameter></term>
<listitem>
<listitem>
<para>Name of connected database (string/<symbol>None</>)
.
</para>
<para>Name of connected database (string/<symbol>None</>)</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -486,7 +482,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -486,7 +482,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<term><parameter>host</parameter></term>
<term><parameter>host</parameter></term>
<listitem>
<listitem>
<para>Name of the server host (string/<symbol>None</>)
.
</para>
<para>Name of the server host (string/<symbol>None</>)</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -494,7 +490,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -494,7 +490,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<term><parameter>port</parameter></term>
<term><parameter>port</parameter></term>
<listitem>
<listitem>
<para>Port used by the database server (integer/-1)
.
</para>
<para>Port used by the database server (integer/-1)</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -503,7 +499,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -503,7 +499,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<listitem>
<listitem>
<para>
<para>
Options for the server (string/<symbol>None</>)
.
Options for the server (string/<symbol>None</>)
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -513,8 +509,8 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -513,8 +509,8 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<listitem>
<listitem>
<para>
<para>
File or
tty for optional debug output from backend
File or
TTY for optional debug output from server
(string/<symbol>None</>)
.
(string/<symbol>None</>)
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -524,7 +520,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -524,7 +520,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<listitem>
<listitem>
<para>
<para>
<productname>PostgreSQL</productname> user (string/<symbol>None</>)
.
<productname>PostgreSQL</productname> user (string/<symbol>None</>)
</para>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -533,7 +529,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -533,7 +529,7 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<term><parameter>passwd</parameter></term>
<term><parameter>passwd</parameter></term>
<listitem>
<listitem>
<para>Password for user (string/<symbol>None</>)
.
</para>
<para>Password for user (string/<symbol>None</>)</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
</variablelist>
...
@@ -601,12 +597,11 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
...
@@ -601,12 +597,11 @@ connect(<optional><parameter>dbname</parameter></optional>, <optional><parameter
<para>
<para>
This method opens a connection to a specified database on a given
This method opens a connection to a specified database on a given
<productname>PostgreSQL</productname> server. You can use
<productname>PostgreSQL</productname> server. The arguments can be
key words here, as described in the
given using key words here. The names of the
<application>Python</application> tutorial. The names of the
key words are the name of the parameters given in the syntax
key words are the name of the parameters given in the syntax
line. For a precise description of the parameters, please refer
line. For a precise description of the parameters, please refer
to
the <productname>PostgreSQL</productname> user manual
.
to
<xref linkend="libpq">
.
</para>
</para>
</refsect1>
</refsect1>
...
...
doc/src/sgml/xplang.sgml
View file @
a8cb3368
<!--
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.2
0 2003/01/31 00:10:51 tgl
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.2
1 2003/04/07 01:29:26 petere
Exp $
-->
-->
<chapter id="xplang">
<chapter id="xplang">
<title id="xplang-title">Procedural Languages</title>
<title id="xplang-title">Procedural Languages</title>
<sect1 id="xplang-intro">
<title>Introduction</title>
<para>
<para>
<productname>PostgreSQL</productname> allows users to add new
<productname>PostgreSQL</productname> allows users to add new
programming languages to be available for writing functions and
programming languages to be available for writing functions and
...
@@ -21,7 +18,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.20 2003/01/31 00:10:51 tgl
...
@@ -21,7 +18,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.20 2003/01/31 00:10:51 tgl
could serve as <quote>glue</quote> between
could serve as <quote>glue</quote> between
<productname>PostgreSQL</productname> and an existing implementation
<productname>PostgreSQL</productname> and an existing implementation
of a programming language. The handler itself is a special
of a programming language. The handler itself is a special
programming
language function compiled into a shared object and
C
language function compiled into a shared object and
loaded on demand.
loaded on demand.
</para>
</para>
...
@@ -31,7 +28,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.20 2003/01/31 00:10:51 tgl
...
@@ -31,7 +28,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.20 2003/01/31 00:10:51 tgl
available in the standard <productname>PostgreSQL</productname>
available in the standard <productname>PostgreSQL</productname>
distribution, which can serve as examples.
distribution, which can serve as examples.
</para>
</para>
</sect1>
<sect1 id="xplang-install">
<sect1 id="xplang-install">
<title>Installing Procedural Languages</title>
<title>Installing Procedural Languages</title>
...
@@ -39,22 +35,24 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.20 2003/01/31 00:10:51 tgl
...
@@ -39,22 +35,24 @@ $Header: /cvsroot/pgsql/doc/src/sgml/xplang.sgml,v 1.20 2003/01/31 00:10:51 tgl
<para>
<para>
A procedural language must be <quote>installed</quote> into each
A procedural language must be <quote>installed</quote> into each
database where it is to be used. But procedural languages installed in
database where it is to be used. But procedural languages installed in
the
template1 database
are automatically available in all
the
database <literal>template1</>
are automatically available in all
subsequently created databases. So the database administrator can
subsequently created databases. So the database administrator can
decide which languages are available in which databases
,
and can make
decide which languages are available in which databases and can make
some languages available by default if he chooses.
some languages available by default if he chooses.
</para>
</para>
<para>
<para>
For the languages supplied with the standard distribution, the
For the languages supplied with the standard distribution, the
shell script <filename>createlang</filename> may be used instead
program <command>createlang</command> may be used to install the
of carrying out the details by hand. For example, to install <application>PL/pgSQL</application>
language instead of carrying out the details by hand. For
into the template1 database, use
example, to install the language
<application>PL/pgSQL</application> into the database
<literal>template1</>, use
<programlisting>
<programlisting>
createlang plpgsql template1
createlang plpgsql template1
</programlisting>
</programlisting>
The manual procedure described below is only recommended for
The manual procedure described below is only recommended for
installing custom languages that <
filename>createlang</filename
>
installing custom languages that <
command>createlang</command
>
does not know about.
does not know about.
</para>
</para>
...
@@ -64,8 +62,11 @@ createlang plpgsql template1
...
@@ -64,8 +62,11 @@ createlang plpgsql template1
</title>
</title>
<para>
<para>
A procedural language is installed in the database in three
A procedural language is installed in a database in three steps,
steps, which must be carried out by a database superuser.
which must be carried out by a database superuser. The
<command>createlang</command> programm automates <xref
linkend="xplang-install-cr1"> and <xref
linkend="xplang-install-cr2">.
</para>
</para>
<step performance="required">
<step performance="required">
...
@@ -81,12 +82,13 @@ createlang plpgsql template1
...
@@ -81,12 +82,13 @@ createlang plpgsql template1
<para>
<para>
The handler must be declared with the command
The handler must be declared with the command
<synopsis>
<synopsis>
CREATE FUNCTION <replaceable>handler_function_name</replaceable> ()
CREATE FUNCTION <replaceable>handler_function_name</replaceable>()
RETURNS LANGUAGE_HANDLER AS
RETURNS language_handler
'<replaceable>path-to-shared-object</replaceable>' LANGUAGE C;
AS '<replaceable>path-to-shared-object</replaceable>'
LANGUAGE C;
</synopsis>
</synopsis>
The special return type of <type>
LANGUAGE_HANDLER
</type> tells
The special return type of <type>
language_handler
</type> tells
the database that this function does not return one of
the database
system
that this function does not return one of
the defined <acronym>SQL</acronym> data types and is not directly usable
the defined <acronym>SQL</acronym> data types and is not directly usable
in <acronym>SQL</acronym> statements.
in <acronym>SQL</acronym> statements.
</para>
</para>
...
@@ -99,7 +101,7 @@ CREATE FUNCTION <replaceable>handler_function_name</replaceable> ()
...
@@ -99,7 +101,7 @@ CREATE FUNCTION <replaceable>handler_function_name</replaceable> ()
CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <replaceable>language-name</replaceable>
CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <replaceable>language-name</replaceable>
HANDLER <replaceable>handler_function_name</replaceable>;
HANDLER <replaceable>handler_function_name</replaceable>;
</synopsis>
</synopsis>
The optional key word <literal>TRUSTED</literal>
tells whether
The optional key word <literal>TRUSTED</literal>
specifies that
ordinary database users that have no superuser privileges should
ordinary database users that have no superuser privileges should
be allowed to use this language to create functions and trigger
be allowed to use this language to create functions and trigger
procedures. Since PL functions are executed inside the database
procedures. Since PL functions are executed inside the database
...
@@ -119,20 +121,12 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re
...
@@ -119,20 +121,12 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re
</procedure>
</procedure>
<para>
<para>
In a default <productname>PostgreSQL</productname> installation,
<xref linkend="xplang-install-example"> shows how the manual
the handler for the <application>PL/pgSQL</application> language
installation procedure would work with the language
is built and installed into the <quote>library</quote>
<application>PL/pgSQL</application>.
directory. If <application>Tcl/Tk</> support is configured in, the handlers for
<application>PL/Tcl</> and <application>PL/TclU</> are also built and installed in the same
location. Likewise, the <application>PL/Perl</> and <application>PL/PerlU</> handlers are built
and installed if Perl support is configured, and <application>PL/Python</> is
installed if Python support is configured. The
<filename>createlang</filename> script automates <xref
linkend="xplang-install-cr1"> and <xref
linkend="xplang-install-cr2"> described above.
</para>
</para>
<example>
<example
id="xplang-install-example"
>
<title>Manual Installation of <application>PL/pgSQL</application></title>
<title>Manual Installation of <application>PL/pgSQL</application></title>
<para>
<para>
...
@@ -140,7 +134,7 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re
...
@@ -140,7 +134,7 @@ CREATE <optional>TRUSTED</optional> <optional>PROCEDURAL</optional> LANGUAGE <re
shared object for the <application>PL/pgSQL</application> language's call handler function.
shared object for the <application>PL/pgSQL</application> language's call handler function.
<programlisting>
<programlisting>
CREATE FUNCTION plpgsql_call_handler
() RETURNS LANGUAGE_HANDLER
AS
CREATE FUNCTION plpgsql_call_handler
() RETURNS language_handler
AS
'$libdir/plpgsql' LANGUAGE C;
'$libdir/plpgsql' LANGUAGE C;
</programlisting>
</programlisting>
</para>
</para>
...
@@ -157,6 +151,17 @@ CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql
...
@@ -157,6 +151,17 @@ CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql
</para>
</para>
</example>
</example>
<para>
In a default <productname>PostgreSQL</productname> installation,
the handler for the <application>PL/pgSQL</application> language
is built and installed into the <quote>library</quote>
directory. If <application>Tcl/Tk</> support is configured in, the handlers for
<application>PL/Tcl</> and <application>PL/TclU</> are also built and installed in the same
location. Likewise, the <application>PL/Perl</> and <application>PL/PerlU</> handlers are built
and installed if Perl support is configured, and <application>PL/Python</> is
installed if Python support is configured.
</para>
</sect1>
</sect1>
</chapter>
</chapter>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment