]> begriffs open source - ai-pg/blob - full-docs/html/xfunc.html
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / html / xfunc.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>36.3. User-Defined Functions</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="extend-type-system.html" title="36.2. The PostgreSQL Type System" /><link rel="next" href="xproc.html" title="36.4. User-Defined Procedures" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">36.3. User-Defined Functions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="extend-type-system.html" title="36.2. The PostgreSQL Type System">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="extend.html" title="Chapter 36. Extending SQL">Up</a></td><th width="60%" align="center">Chapter 36. Extending <acronym class="acronym">SQL</acronym></th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="xproc.html" title="36.4. User-Defined Procedures">Next</a></td></tr></table><hr /></div><div class="sect1" id="XFUNC"><div class="titlepage"><div><div><h2 class="title" style="clear: both">36.3. User-Defined Functions <a href="#XFUNC" class="id_link">#</a></h2></div></div></div><a id="id-1.8.3.6.2" class="indexterm"></a><p>
3    <span class="productname">PostgreSQL</span> provides four kinds of
4    functions:
5
6    </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
7       query language functions (functions written in
8       <acronym class="acronym">SQL</acronym>) (<a class="xref" href="xfunc-sql.html" title="36.5. Query Language (SQL) Functions">Section 36.5</a>)
9      </p></li><li class="listitem"><p>
10       procedural language functions (functions written in, for
11       example, <span class="application">PL/pgSQL</span> or <span class="application">PL/Tcl</span>)
12       (<a class="xref" href="xfunc-pl.html" title="36.8. Procedural Language Functions">Section 36.8</a>)
13      </p></li><li class="listitem"><p>
14       internal functions (<a class="xref" href="xfunc-internal.html" title="36.9. Internal Functions">Section 36.9</a>)
15      </p></li><li class="listitem"><p>
16       C-language functions (<a class="xref" href="xfunc-c.html" title="36.10. C-Language Functions">Section 36.10</a>)
17      </p></li></ul></div><p>
18   </p><p>
19    Every kind
20    of  function  can take base types, composite types, or
21    combinations of these as arguments (parameters). In addition,
22    every kind of function can return a base type or
23    a composite type.  Functions can also be defined to return
24    sets of base or composite values.
25   </p><p>
26    Many kinds of functions can take or return certain pseudo-types
27    (such as polymorphic types), but the available facilities vary.
28    Consult the description of each kind of function for more details.
29   </p><p>
30    It's easiest to define <acronym class="acronym">SQL</acronym>
31    functions, so we'll start by discussing those.
32    Most of the concepts presented for <acronym class="acronym">SQL</acronym> functions
33    will carry over to the other types of functions.
34   </p><p>
35    Throughout this chapter, it can be useful to look at the reference
36    page of the <a class="link" href="sql-createfunction.html" title="CREATE FUNCTION"><code class="command">CREATE
37    FUNCTION</code></a> command to
38    understand the examples better.  Some examples from this chapter
39    can be found in <code class="filename">funcs.sql</code> and
40    <code class="filename">funcs.c</code> in the <code class="filename">src/tutorial</code>
41    directory in the <span class="productname">PostgreSQL</span> source
42    distribution.
43   </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="extend-type-system.html" title="36.2. The PostgreSQL Type System">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extend.html" title="Chapter 36. Extending SQL">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="xproc.html" title="36.4. User-Defined Procedures">Next</a></td></tr><tr><td width="40%" align="left" valign="top">36.2. The <span class="productname">PostgreSQL</span> Type System </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 36.4. User-Defined Procedures</td></tr></table></div></body></html>