1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>32.3.User-Defined Functions</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="extend.html" title="Chapter32.Extending SQL">
<link rel="prev" href="extend-type-system.html" title="32.2.The PostgreSQL Type System">
<link rel="next" href="xfunc-sql.html" title="32.4.Query Language (SQL) Functions">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="xfunc"></a>32.3.User-Defined Functions</h2></div></div></div>
<a name="id703966"></a><p> <span class="productname">PostgreSQL</span> provides four kinds of
functions:
</p>
<div class="itemizedlist"><ul type="disc">
<li><p> query language functions (functions written in
<acronym class="acronym">SQL</acronym>) (<a href="xfunc-sql.html" title="32.4.Query Language (SQL) Functions">Section32.4, “Query Language (<acronym class="acronym">SQL</acronym>) Functions”</a>)
</p></li>
<li><p> procedural language functions (functions written in, for
example, <span class="application">PL/pgSQL</span> or <span class="application">PL/Tcl</span>)
(<a href="xfunc-pl.html" title="32.7.Procedural Language Functions">Section32.7, “Procedural Language Functions”</a>)
</p></li>
<li><p> internal functions (<a href="xfunc-internal.html" title="32.8.Internal Functions">Section32.8, “Internal Functions”</a>)
</p></li>
<li><p> C-language functions (<a href="xfunc-c.html" title="32.9.C-Language Functions">Section32.9, “C-Language Functions”</a>)
</p></li>
</ul></div>
<p>
</p>
<p> Every kind
of function can take base types, composite types, or
combinations of these as arguments (parameters). In addition,
every kind of function can return a base type or
a composite type. Functions may also be defined to return
sets of base or composite values.
</p>
<p> Many kinds of functions can take or return certain pseudo-types
(such as polymorphic types), but the available facilities vary.
Consult the description of each kind of function for more details.
</p>
<p> It's easiest to define <acronym class="acronym">SQL</acronym>
functions, so we'll start by discussing those.
Most of the concepts presented for <acronym class="acronym">SQL</acronym> functions
will carry over to the other types of functions.
</p>
<p> Throughout this chapter, it can be useful to look at the reference
page of the <a href="sql-createfunction.html">CREATE FUNCTION</a> command to
understand the examples better. Some examples from this chapter
can be found in <code class="filename">funcs.sql</code> and
<code class="filename">funcs.c</code> in the <code class="filename">src/tutorial</code>
directory in the <span class="productname">PostgreSQL</span> source
distribution.
</p>
</div></body>
</html>
|